问题
I wrote a simple serialization function in order to store a fileTree representation (based on the composite pattern...), but always get following error:
java.io.NotSerializableException: sun.nio.fs.WindowsPath
Unfortunately I couldn't figure out so far how to fix that - anyone else encountered that?
回答1:
Serialize it as a String instead of a Path.
来源:https://stackoverflow.com/questions/26011679/java-io-notserializableexception-sun-nio-fs-windowspath-how-to-fix-it