   [java] Serializing objects overide, making static values transferable.
  Im writing a java program and networking it very basic game as far as games go but I have hit an issue, I have a value that everyone needs to use to know the game was started by the host.its public static isGameStartedIt being static means that java wont serialize and send it for me and that on the recieving end the static value stays as the static value of the clients side of things which is false so only the host ends up in the game talking to all the clients in the lobby.It will take days to modify the system to bypass having static values held by the players in a player class linked list with static values for afew key things such as is the game started so I did some digging and found that you can overwrite the read and write objects, however watching the writing process it wont write the additional value from the static field. The writing class claims it works fine but watching it in the debug the extra write appears ignored.    private void writeObject(ObjectOutputStream oos)   throws IOException {   oos.defaultWriteObject();   // Write/save additional fields   boolean tempB = isStartedGame;   oos.writeBoolean(tempB);    }    @SuppressWarnings("static-access")    private void readObject(ObjectInputStream ois)   throws ClassNotFoundException, IOException {   ois.defaultReadObject();   // Read/initialize additional fields in order they are written   *this.isStartedGame = ois.readBoolean();    }It fails on the recieving end on the line with a * on it.I end up getting an end of file complaint, so the value is not getting written into the ouput stream.This is how im calling the overridden function.public synchronized byte[] convertObjectToPacketData(){   ByteArrayOutputStream baoStream;   ObjectOutputStream ouStream;   byte[] tempByte = null;   try{  baoStream = new ByteArrayOutputStream();  ouStream = new ObjectOutputStream(baoStream);  ouStream.flush();  ouStream.writeObject(this);//This at this point is the playerdata object if you make it the ouStream you dont reach the overide so I assume this is correct syntax.  ouStream.flush();  tempByte = baoStream.toByteArray();  ouStream.close();  baoStream.close();I wish there was an opposite to the transient keyword so I could get it to intuitvely update the static field on the client side with the servers details for the object as the hosts object overwrites the clients object.Does anyone know serializing well enough to help me correct the fault here?The only detailed tutorial on this topic is this site below everywhere else says much the same but without a tutorial.http://java.sun.com/developer/technicalArticles/ALT/serialization/Thanks EnlightenedOne   
  Have you replaced the old class version with the new one in both network ends?It seems as if you were trying to read and old version of the serialized class that obviously doesn't have the extra info.Also,Are you using a serialVersionUID?I suggest you to use a manual value (something like yyyymmddhhmm) every time you change the source code of the class. It will help you to detect this kind of errors.   ;  The writeObject and readObject methods of the object streams are designed to work for single instances only. If you want to transfer the static values, transfer them the same way you transfer any other value. Object streams are suitable for this kind of data transfer.   