Java Intellij剪贴板备份 [英] Java intellij clipboard backup
问题描述
我正在编写一个在剪贴板上运行的程序,我想在启动时备份剪贴板内容,并在完成后还原它.看起来像这样:
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);
通常它可以正常工作,但是当我从Intellij复制一部分代码并运行程序时,它会抛出:
it works fine in general, but when I copy a part of code from Intellij, and run my program, it throws:
在为以下应用程序构造DataFlavor时,异常"java.lang.ClassNotFoundException:com/intellij/codeInsight/editorActions/FoldingData";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
在为以下应用程序构造DataFlavor时,异常"java.lang.ClassNotFoundException:com/intellij/codeInsight/editorActions/FoldingData";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
在为以下应用程序构造DataFlavor时,异常"java.lang.ClassNotFoundException:org/jetbrains/plugins/scala/conversion/copy/Associations";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
在为以下应用程序构造DataFlavor时,异常"java.lang.ClassNotFoundException:org/jetbrains/plugins/scala/conversion/copy/Associations";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
即使doSomething函数为空.
even if doSomething function is empty.
是否可以从剪贴板备份任何内容?如果没有,该如何处理?
Is it possible to backup ANY content from clipboard? If not, how to handle such problem?
推荐答案
"Exception" java.lang.ClassNotFoundException:com/intellij/codeInsight/editorActions/FoldingData"DataFlavor适用于:application/x-java-jvm-local-objectref;class = com.intellij.codeInsight.editorActions.FoldingData异常"java.lang.ClassNotFoundException:com/intellij/codeInsight/editorActions/FoldingData"DataFlavor适用于: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: com/intellij/codeInsight/editorActions/FoldingData"while constructing DataFlavor for: application/x-java-jvm-local-objectref; class=com.intellij.codeInsight.editorActions.FoldingData"
我遇到了此错误-我去了IntelliJ
I had this error - I go to my IntelliJ to
文件->项目结构
然后我将特定于模块的SDK从"1.8 Java版本...."切换到了"IntelliJ IDEA IU -162.1447 ...",并且一切正常.
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.
这篇关于Java Intellij剪贴板备份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!