开发者

I get a class not found exception when i rename the package from "default package"

开发者 https://www.devze.com 2023-03-07 20:39 出处:网络
I get a class not found exception when i rename the package from \"default package\" in java. When i run the code within the default package, the code works fine but when i p开发者_运维问答aste the co

I get a class not found exception when i rename the package from "default package" in java. When i run the code within the default package, the code works fine but when i p开发者_运维问答aste the code into a new java project in eclipse and into a new package, there is a classnotfound exception thrown even when the class referred to above is clearly present in the new package. What is wrong? please help me :(


My guess is that you're still trying to start the application with the existing application launcher, which is referring to the class in the "default" package.

Either create a new launcher, or edit the details of the existing one.

Of course, that's assuming you get the exception on launch. If that's not the case, you need to give us a lot more details.

EDIT: Okay, now you've posted the exception, it makes a lot more sense - you're trying to deserialize data which includes a reference to the class FaceBundle. Renaming classes breaks serialized data - it's as simple as that.

You can fiddle around with things in Java serialization, but I haven't done so myself. I suspect you'd want to create your own subclass of ObjectInputStream and override resolveClass.

0

精彩评论

暂无评论...
验证码 换一张
取 消