Transferable オブジェクトをシリアル化して、オブジェクト データ ストリーム経由で送信できるようにする必要がありますが、実行時にエラー java.io.NotSerializableException が発生し、何が問題なのかわかりません。これを修正するにはどうすればよいですか?
エラーの原因となっているコードの部分は次のとおりです
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
Transferable contents = clipboard.getContents(null);
System.out.println(contents);
//Initialiaze ObjectStreams
FileOutputStream fos = new FileOutputStream("t.tmp");
ObjectOutputStream oos = new ObjectOutputStream(fos);
//write objects
oos.writeObject(contents);
oos.close();