Skip to main content

Will java.nio.file.Path implement Serializable?

1 reply [Last post]
asailer
Offline
Joined: 2006-11-09

Will java.nio.file.Path implement Serializable?

I'm trying to serialize an object that contains a Path object.

This results in:
java.io.NotSerializableException: sun.nio.fs.UnixPath

Using:
JDK 1.7.0-ea-b63

Message was edited by: asailer

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
alanb
Offline
Joined: 2005-08-08

The nio-discuss mailing list would be the best place to bring this up. In short, Path is an abstract class that is designed to be extended. The simplest workaround is for your writeObject method to serialize the path as a URI or as a String where it make sense.