Java error when opening the editor

87 次查看(过去 30 天)
Enrica Soria
Enrica Soria 2019-10-3
编辑: Kepeng Qiu 2019-10-13
Hello,
I'm having the following error when trying to open any of the .m files with the Matlab editor:
Exception in thread "AWT-EventQueue-0": java.lang.NoClassDefFoundError: Could not initialize class com.mathworks.widgets.text.mcode.MSettingsInitializer
at com.mathworks.widgets.text.mcode.analyzer.CodeAnalyzerLayer.isMLintEnabledInPreferences(CodeAnalyzerLayer.java:411)
at com.mathworks.widgets.text.mcode.analyzer.CodeAnalyzerLayer.shouldShow(CodeAnalyzerLayer.java:404)
at com.mathworks.widgets.text.mcode.analyzer.CodeAnalyzerLayer.possiblyEnableOrDisableLayer(CodeAnalyzerLayer.java:166)
at com.mathworks.widgets.text.mcode.analyzer.CodeAnalyzerLayer.settingsChanged(CodeAnalyzerLayer.java:444)
at com.mathworks.widgets.text.MWEditorUI.settingsChange(MWEditorUI.java:479)
at org.netbeans.editor.EditorUI.modelChanged(EditorUI.java:655)
at org.netbeans.editor.EditorUI.installUI(EditorUI.java:357)
at com.mathworks.widgets.text.MWEditorUI.installUI(MWEditorUI.java:600)
at org.netbeans.editor.BaseTextUI.installUI(BaseTextUI.java:197)
at javax.swing.JComponent.setUI(JComponent.java:666)
at javax.swing.text.JTextComponent.setUI(JTextComponent.java:328)
at org.netbeans.editor.BaseKit.install(BaseKit.java:514)
at javax.swing.JEditorPane.setEditorKit(JEditorPane.java:1054)
at javax.swing.JEditorPane.setContentType(JEditorPane.java:978)
at com.mathworks.widgets.SyntaxTextPaneMultiView.setContentType(SyntaxTextPaneMultiView.java:519)
at com.mathworks.mde.editor.EditorView.initSyntaxTextPane(EditorView.java:820)
at com.mathworks.mde.editor.EditorView.<init>(EditorView.java:222)
at com.mathworks.mde.editor.EditorView.<init>(EditorView.java:153)
at com.mathworks.mde.editor.EditorViewClient.init(EditorViewClient.java:232)
at com.mathworks.mde.editor.EditorViewClient.<init>(EditorViewClient.java:181)
at com.mathworks.mde.editor.MatlabEditorApplication.createEditorViewClient(MatlabEditorApplication.java:693)
at com.mathworks.mde.editor.MatlabEditorApplication.createEditorViewClient(MatlabEditorApplication.java:678)
at com.mathworks.mde.editor.MatlabEditorApplication.createEditorViewClientFromExistingFile(MatlabEditorApplication.java:670)
at com.mathworks.mde.editor.MatlabEditorApplication.access$300(MatlabEditorApplication.java:73)
at com.mathworks.mde.editor.MatlabEditorApplication$4.runWithOutput(MatlabEditorApplication.java:395)
at com.mathworks.jmi.AWTUtilities$Invoker$2.watchedRun(AWTUtilities.java:475)
at com.mathworks.jmi.AWTUtilities$WatchedRunnable.run(AWTUtilities.java:436)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
I'm on Ubuntu 16.04 and my java version is the following:
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1ubuntu1~16.04.1-b10)
OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)
Does anybody have a clue of what it is happening? I didn't upgrade java nor matlab before having this problem.
I'm using matlabM2019a, but even after installing matlabR2019b I get the same error.

回答(1 个)

Enrica Soria
Enrica Soria 2019-10-3
For me, removing the preference folder was the solution. To do so, type the following in your terminal:
cd ~/.matlab
mv R2019a R2019a_removed
  1 个评论
Kepeng Qiu
Kepeng Qiu 2019-10-13
编辑:Kepeng Qiu 2019-10-13
That's great!!!
I have used your idea to solve the same problem.
'''
Operating system: windows 10
MATLAB version: R2019b
java version: Java 1.8.0_202-b08
'''
I just deleted this folder 'R2019b' at the path
'C:\Users\yourname\AppData\Roaming\MathWorks\MATLAB\R2019b' and restarted MATLAB.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by