java.io.NotSerializableException:sun.nio.fs.WindowsPath-如何解决? [英] java.io.NotSerializableException: sun.nio.fs.WindowsPath - how to fix it?

查看:312
本文介绍了java.io.NotSerializableException:sun.nio.fs.WindowsPath-如何解决?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个简单的序列化函数来存储fileTree表示形式(基于复合模式...),但是总是出现以下错误:

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?

推荐答案

将其序列化为字符串而不是路径.

Serialize it as a String instead of a Path.

这篇关于java.io.NotSerializableException:sun.nio.fs.WindowsPath-如何解决?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆