serialVersionUID for serizlizable class

Possible Duplicate: What does it mean: The serializable class does not declare a static final serialVersionUID field? The serializable class VaadintestprojectApplication does not declare a static final serialVersionUID field of type long What does this statement mean? I get an error for this. What does serizlizable class do and why do we need to declare a static final for it. 你应该看看

serialVersionUID用于serizlizable类

可能重复: 这是什么意思:可序列化的类不声明静态最终serialVersionUID字段? 可序列化的类VaadintestprojectApplication不声明long类型的静态final serialVersionUID字段 这个说法是什么意思? 我得到这个错误。 serizlizable类做了什么,为什么我们需要为它声明一个静态的final。 你应该看看Serializable javadoc,这比任何StackOverflow贡献者都更好地解释了这一点。

How to run Java frame over ssh

I have to run a java program which has a applet embedded within a Frame . I am doing this because I want to run applet as a application. It works awesome when I run it on my local machine but It does not when I want to do it in remote machine. The program seems to be running my main () but I am not able to see the window. I tried ssh -X and ssh -t but of no use. Here is the test code pu

如何通过ssh运行Java框架

我必须运行一个Java程序,其中有一个嵌入在框架内的小程序。 我这样做是因为我想将applet作为应用程序运行。 当我在本地机器上运行它时,它运行得非常棒,但它不会在远程机器上运行。 该程序似乎正在运行我的主(),但我无法看到窗口。 我试过ssh -X和ssh -t但没用。 这是测试代码 public static void main(String args[]){ final DatingGUI applet = new DatingGUI(); applet.init(); apple

IntelliJ Idea generating serialVersionUID

My question is how to generate this value in IDEA? I go to Settings -> Errors -> Serialization issues -> Serializable class without 'serialVersionUID' but it still dont show me the warning. My class PKladrBuilding parent implements interface Serializable. Part of the code: public class PKladrBuilding extends PRQObject public abstract class PRQObject extends PObject public

生成serialVersionUID的IntelliJ Idea

我的问题是如何在IDEA中生成这个值? 我去设置 - >错误 - >序列化问题 - > Serializable类没有'serialVersionUID',但它仍然没有告诉我的警告。 我的类PKladrBuilding父实现接口Serializable。 部分代码: public class PKladrBuilding extends PRQObject public abstract class PRQObject extends PObject public abstract class PObject implements Serializable 我不知道你是否有旧版本的IntelliJ,

JTree select node by clicking anywhere on the row

I have code taken from here that would allow selection of a JTree Row by clicking anywhere on the row. it works fine in single row selection mode. However, I am not sure how to modify it in order to handle multiple row selections. how do I distinguish the case when user is make a multiple selection(eg. by holding down the shift or control button while making a left mouse click on a row)? imp

JTree通过单击行上的任何位置来选择节点

我从这里获取的代码可以通过单击行上的任何位置来选择JTree行。 它在单行选择模式下工作正常。 但是,我不知道如何修改它以处理多行选择。 当用户进行多重选择时(例如在按住鼠标左键的同时按住shift键或控制键),如何区分这种情况? import java.awt.Rectangle; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.JFrame; import javax.s

java swing clear the event queue

Is it possible to do this in a standard manner? Here is the scenario. Start doing something expensive in EDT (EDT is blocked till the expensive operation is over). While EDT was blocked, the user kept on clicking/dragging the mouse buttons. All the mouse actions are recorded somewhere. When EDT is free (done with the expensive stuff), it starts to process the mouse events. What I want

java swing清除事件队列

是否有可能以标准方式做到这一点? 这是场景。 在美国东部时间开始做一些昂贵的东西(美国东部时间被封锁,直到昂贵的操作结束) 当EDT被阻止时,用户不断点击/拖动鼠标按钮。 所有的鼠标操作都被记录在某处。 当EDT是免费的(用昂贵的东西完成),它开始处理鼠标事件。 我想在第3步中放弃堆积的鼠标事件。 EDT免费后,任何新的鼠标事件都应按照常规方式处理。 任何想法如何实现这一点。 PS:我不可能阻止EDT被

Why generate long serialVersionUID instead of a simple 1L?

When class implements Serializable in Eclipse, I have two options: add default serialVersionUID(1L) or generated serialVersionUID(3567653491060394677L) . I think that first one is cooler, but many times I saw people using the second option. Is there any reason to generate long serialVersionUID ? As far as I can tell, that would be only for compatibility with previous releases. This would onl

为什么生成long serialVersionUID而不是简单的1L?

当类在Eclipse中实现Serializable时,我有两个选择:添加默认serialVersionUID(1L)或生成serialVersionUID(3567653491060394677L) 。 我认为第一个更酷,但很多时候我看到有人使用第二个选项。 是否有任何理由生成long serialVersionUID ? 据我所知,这只是为了与以前的版本兼容。 如果您之前忽略使用serialVersionUID,那么这只会非常有用,然后进行了一项更改,您知道该更改应该是兼容的,但会导致序列化中断。 有关更

Use the serialVersionUID or suppress warnings?

I want to create a class that, for example, extends HttpServlet? My compiler warns me that my class should have a serialVersionUID. If I know that this object will never be serialized, should I define it or add an annotation to suppress those warnings? What would you do and why? I don't know Java best practices, but it occurs to me that if you are claiming that serialization will never

使用serialVersionUID还是禁止警告?

我想创建一个类,例如,扩展HttpServlet? 我的编译器警告我,我的类应该有一个serialVersionUID。 如果我知道这个对象永远不会被序列化,我应该定义它还是添加一个注释来抑制这些警告? 你会做什么,为什么? 我不知道Java的最佳实践,但是在我看来,如果你声称序列化永远不会发生,你可以添加一个抛出的writeObject方法。 然后在知道它不可能适用于你的情况下安全地发出警告。 否则有人可能会在未来通过父类序列化对

How to handle java.io.InvalidClassException?

This question already has an answer here: What is a serialVersionUID and why should I use it? 21 answers You are using a different version of the Applicant class. Maybe you first wrote the Applicant class object to the database and after that, you modified the class. That's why you are getting this message. Write the object to the database again and then try to deserialize it.

如何处理java.io.InvalidClassException?

这个问题在这里已经有了答案: 什么是serialVersionUID,为什么我应该使用它? 21个答案 您正在使用不同版本的申请人课程。 也许你首先将申请人类对象写入数据库,然后修改该类。 这就是为什么你收到这个消息。 再次将对象写入数据库,然后尝试对其进行反序列化。

Why does Eclipse warn me to add a serialVersionUID?

Possible Duplicate: Why should I bother about serialVersionUID? I've been learning how to use Java's graphics classes. When I made a simple FlowLayout, I got a warning in Eclipse IDE telling me I should add a serialversionUID before my Layout contructor class. It now looks like: public class ShowFlowLayout extends JFrame{ /** * */ private static final long serialVersionUID = 1L

为什么Eclipse警告我添加一个serialVersionUID?

可能重复: 为什么我应该打扰serialVersionUID? 我一直在学习如何使用Java的图形类。 当我做了一个简单的FlowLayout时,我在Eclipse IDE中得到了一个警告,告诉我应该在Layout构造函数类之前添加一个serialversionUID。 它现在看起来像: public class ShowFlowLayout extends JFrame{ /** * */ private static final long serialVersionUID = 1L; public ShowFlowLayout() {... 什么是serialVersionUID? 有重要

Importance of serialVersionId in Serialization?

This question already has an answer here: What is a serialVersionUID and why should I use it? 21 answers It is used to check whether the same class definition was used for Serialization as well as DeSerialization. Straight from the documentation The serialization runtime associates with each serializable class a version number, called a serialVersionUID, which is used during deserializati

SerialVersionId在序列化中的重要性?

这个问题在这里已经有了答案: 什么是serialVersionUID,为什么我应该使用它? 21个答案 它用于检查序列化和DeSerialization是否使用了相同的类定义。 直接从文档 序列化运行时与每个可序列化类关联一个称为serialVersionUID的版本号,在反序列化过程中使用该版本号来验证序列化对象的发送者和接收者是否已加载该对象的与序列化相容的类。 如果接收者已经为与对应的发送者类具有不同serialVersionUID的对象加载了类,则