title: Java intellij clipboard backup
body: <p>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:</p>
  <pre><code>data = Toolkit.getDefaultToolkit.getSystemClipboard.getContents(this);
  doSomething();
  Toolkit.getDefaultToolkit.getSystemClipboard.setContents(data, this);
  </code></pre>
  <p>it works fine in general, but when I copy a part of code from Intellij, and run my program, it throws:</p>
  <blockquote>
  <p>Exception &quot;java.lang.ClassNotFoundException: com/intellij/codeInsight/editorActions/FoldingData&quot;while constructing DataFlavor for: application/x-java-jvm-local-objectref; class=com.intellij.codeInsight.editorActions.FoldingData</p>
  <p>Exception &quot;java.lang.ClassNotFoundException: com/intellij/codeInsight/editorActions/FoldingData&quot;while constructing DataFlavor for: application/x-java-jvm-local-objectref; class=com.intellij.codeInsight.editorActions.FoldingData</p>
  <p>Exception &quot;java.lang.ClassNotFoundException: org/jetbrains/plugins/scala/conversion/copy/Associations&quot;while constructing DataFlavor for: application/x-java-serialized-object; class=org.jetbrains.plugins.scala.conversion.copy.Associations</p>
  <p>Exception &quot;java.lang.ClassNotFoundException: org/jetbrains/plugins/scala/conversion/copy/Associations&quot;while constructing DataFlavor for: application/x-java-serialized-object; class=org.jetbrains.plugins.scala.conversion.copy.Associations</p>
  </blockquote>
  <p>even if doSomething function is empty.</p>
  <p>Is it possible to backup ANY content from clipboard? If not, how to handle such problem?</p>