java.lang.​ClassNotFo​undExcepti​on in matlabR2014a

227 views (last 30 days)
Dear All
Hi
Im using matlab R2014a. but sometimes give me following error:
Exception "java.lang.ClassNotFoundException: com.intellij.codeInsight.editorActions.FoldingData"while constructing DataFlavor for: application/x-java-jvm-local-objectref; class=com.intellij.codeInsight.editorActions.FoldingData
why? Of course I use pycharm IDE along with matlab. Is it because it?
thanks
  2 Comments
Takashi Li
Takashi Li on 11 Dec 2016
I also get the same problem when I open MATLAB (R2016b) while PyCharm is running.
Matheus Torquato
Matheus Torquato on 13 Mar 2021
I'm calling MATLAB functions from my Python Script and all of the blue the code freezes and MATLAB show this same message.
Exception "java.lang.ClassNotFoundException: com/intellij/codeInsight/editorActions/FoldingData"while constructing DataFlavor for: application/x-java-jvm-local-objectref; class=com.intellij.codeInsight.editorActions.FoldingData

Sign in to comment.

Accepted Answer

Lane Maxwell
Lane Maxwell on 6 Nov 2017
Edited: Lane Maxwell on 3 May 2020
The culprit is likely the contents of the clipboard. Anything that's been copied while running the Jetbrains IDEs results in a serialized Java object being placed onto the clipboard. I assume that Matlab is reading this at startup and trying to do something with it.
There are a couple of ways to solve this. The simplest is to have an empty clipboard (or a clipboard that contains something copied outside of the Jetbrains IDEs) at the time you start Matlab.
The more flexible approach is to create a javaclasspath.txt file that contains the path to idea.jar. That jar file ships with intelliJ/PyCharm and the like. See this link for more information: Static Path - MATLAB & Simulink
  7 Comments
Caroline Aitken
Caroline Aitken on 8 Mar 2022
Same wtih 2021b. This looks like it would be useful, but how EXACTLY do I do this? I'm not familiar enough with assigning flexible paths this way that the documentation also doesn't really help clarify. How does setting the file to contain idea.jar stop matlab from trying to look there? What do you mean by "the jar file ships with intelliJ"? I'm just not familiar enough with standard lingo and practice to understand what really needs to happen here. If you could clarify I would really appreciate it.
Lane Maxwell
Lane Maxwell on 9 Mar 2022
Hi Caroline,
Basically you have to add a file called javaclasspath.txt into your MATLAB preferences directory that contains the fully qualified path to the JAR file that contains the class in question, in this case that class is com.intellij.codeInsight.editorActions.FoldingData.
However, because that class is bundled in a jar provided by JetBrains when you install one of their products, they're free to move it around and whatnot, which they have done since I initially answered this back in 2017. That class is no longer in idea.jar, it is now in platform-impl.jar. So, on your computer, locate the platform-impl.jar file and add a line into javaclasspath.txt that points to this file, on my computer it is ~/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/213.6777.52/IntelliJ IDEA.app/Contents/lib/platform-impl.jar but it may be different for you.
You'll need to place the newly created javaclasspath.txt into your preferences directory for matlab, which you can find by opening matlab and running the command, prefdir. Place the file in the preferences directory and restart matlab. You can verify that it was added by running the command javaclasspath in matlab, you should see your entry at the bottom.
Even by doing this, there's a chance that you'll get other errors like if platform-impl.jar was compiled with a newer version of Java then MATLAB is using.
I have a couple other recommendations.
  1. Simply ignore the error message, it doesn't actually affect any functionality within MATLAB.
  2. Before you open MATLAB, clear your clipboard or copy something to it from outside of one of JetBrains' products.

Sign in to comment.

More Answers (6)

Kristian Sørensen
Kristian Sørensen on 23 Dec 2015
I get the same error when starting MATLAB 2015b while PyCharm CE 5.0.2 is running, and the problem disappears when PyCharm is not running.

Deependra Mishra
Deependra Mishra on 18 Apr 2019
I was running PyCharm earlier. Received same error with MATLAB 2019a. Copied a random text to clipboard and restarted the matlab, the error was gone.

Barna Erdei
Barna Erdei on 19 Apr 2021
Hello, any news or solutions regarded to this topic?
I have the same error with Matlab R2020b and with the Pycharm started !
Any news about this error message ? How can we resolve this error messages ?
" Exception "java.lang.ClassNotFoundException: com/intellij/codeInsight/editorActions/FoldingData"while constructing DataFlavor for: application/x-java-jvm-local-objectref; class=com.intellij.codeInsight.editorActions.FoldingData
Exception "java.lang.ClassNotFoundException: com/intellij/openapi/editor/RawText"while constructing DataFlavor for: application/x-java-jvm-local-objectref; class=com.intellij.openapi.editor.RawText "

Morakot Choetkiertikul
Morakot Choetkiertikul on 16 Feb 2016
I also got the same problem when I open Matlab while IntelliJ is running.
Exception "java.lang.ClassNotFoundException: com/intellij/codeInsight/editorActions/FoldingData"while constructing DataFlavor for: application/x-java-jvm-local-objectref; class=com.intellij.codeInsight.editorActions.FoldingData

Seiwev Hu
Seiwev Hu on 7 Jun 2017
I get the same error when I open MATLAB(R2014b) with the SPSS(22.0) running.
Exception "java.lang.ClassNotFoundException: com.spss.java_client.ui.doc_types.data.serialize.DataSerializer$DataCells"while constructing DataFlavor for: application/x-java-serialized-object; class=com.spss.java_client.ui.doc_types.da

Nick Ivanov
Nick Ivanov on 16 Jul 2020
I had this error with Android Studio open in Linux:
Exception "java.lang.ClassNotFoundException: com/intellij/codeInsight/editorActions/FoldingData"while constructing DataFlavor for: application/x-java-jvm-local-objectref; class=com.intellij.codeInsight.editorActions.FoldingData
After closing the Android Studio, the error disappears.

Categories

Find more on Environment and Settings in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!