问题
I am writing a program operating on clipboard, and I want to make backup of clipboard contents at startup, and restore it when finished. So it looks like:
data = Toolkit.getDefaultToolkit.getSystemClipboard.getContents(this);
doSomething();
Toolkit.getDefaultToolkit.getSystemClipboard.setContents(data, this);
it works fine in general, but when I copy a part of code from Intellij, and run my program, it throws:
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/codeInsight/editorActions/FoldingData"while constructing DataFlavor for: application/x-java-jvm-local-objectref; class=com.intellij.codeInsight.editorActions.FoldingData
Exception "java.lang.ClassNotFoundException: org/jetbrains/plugins/scala/conversion/copy/Associations"while constructing DataFlavor for: application/x-java-serialized-object; class=org.jetbrains.plugins.scala.conversion.copy.Associations
Exception "java.lang.ClassNotFoundException: org/jetbrains/plugins/scala/conversion/copy/Associations"while constructing DataFlavor for: application/x-java-serialized-object; class=org.jetbrains.plugins.scala.conversion.copy.Associations
even if doSomething function is empty.
Is it possible to backup ANY content from clipboard? If not, how to handle such problem?
回答1:
"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/codeInsight/editorActions/FoldingData"while constructing DataFlavor for: application/x-java-jvm-local-objectref; class=com.intellij.codeInsight.editorActions.FoldingData"
I had this error - I go to my IntelliJ to
File -> Project Structure
and I switched the module specific SDK from "1.8 java version...." to "IntelliJ IDEA IU -162.1447..." and it's work fine.
I hope I helped you.
回答2:
The error is caused when you copy something from intellij which stores serialized objects on the clipboard. I found a workaround for this. Check this answer
来源:https://stackoverflow.com/questions/36769139/java-intellij-clipboard-backup