Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

binary comparison

807591Jun 16 2008 — edited Jun 20 2008
When compiling java source programmes, will the java compiler (javac) add different extra information each time to the class files?

I encounter a problem when using default unix comparison tool - cmp. In the cygwin environment, if I wrote a hello world programe, e.g. hello.c and compiled it (`gcc -o hello hello.c` and gcc -o hello1 hello.c) into different binary name, say `hello' and `hello1'. Then compare these two binary files with command `cmp hello.exe hello1.exe`. The result show these binary files are not equal (hello.exe and hello1.exe differ: char 137, line 2).

I did this with java version (also in cygwin version) by compiling Hello.java into Hello1.class and Hello.class. Though result shows they are the same, I wonder if the java with different version or in different environment (e.g. un*x and window) will add different extra information each time during compilation or is there any command I can use to prevent javac to add any extra information to the class files?

Or anyone is able to point me to where containing related information/ document?

Thank you very much.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 17 2008
Added on Jun 16 2008
26 comments
240 views