简体   繁体   English

对象序列化查询和类路径

[英]Object serialization query and class path

I had a question in regards to serializing an object and being able to retrieve the object in a different program. 我有一个关于序列化对象并能够在不同程序中检索对象的问题。 The problem with retrieving an object in a different program is that the program cant find the object(symbol). 在不同程序中检索对象的问题是程序无法找到对象(符号)。 From what I understand this serialized object needs to be on a classpath. 根据我的理解,这个序列化对象需要在类路径上。

(Still a student and not sure exactly what it means to place an object on a class path) (仍然是学生,并不确定将对象放在类路径上的确切含义)

My question is how do you place an object on a classpath using NetBeans 7.0.1? 我的问题是如何使用NetBeans 7.0.1将对象放在类路径上?

Basically you should have the serialized Java Class exported as a JAR file. 基本上,您应该将序列化的Java类导出为JAR文件。 The consuming App, the one which deserializes it, should have this jar on its class path in order to deserialize it... Btw, you are de/serializing an Object ie a Class Instance, not the class itself. 消费App,反序列化它,应该在它的类路径上有这个jar,以便反序列化它...顺便说一句,你是/序列化一个对象即一个类实例,而不是类本身。

Netbeans project-classpath Netbeans项目类路径

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM