aspose file tools
The moose likes Beginning Java and the fly likes java version of .class file Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "java version of .class file" Watch "java version of .class file" New topic
Author

java version of .class file

michael modenese
Greenhorn

Joined: Mar 22, 2006
Posts: 12
Hi there,
i have a question concerning the jdk version i used to compile and jar my project. is there a way to find out from the jar file with what version the project has been compiled ? the "Created-By:" (example : Created-By: 1.5.0_09-b01 (Sun Microsystems Inc.)) from the manifest file in my jar is the version of my jar tool.

thanks, mike
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

See if this helps:
...every .class file you generate contains a version stamp: two unsigned short integers starting at byte offset 4, right after the 0xCAFEBABE magic number. They are the major/minor version numbers of the class format...

Ref: JavaWorld - What Version is Your Java Code? (2003).

Related: JavaWorld - Magic and version numbers (1996).


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

By the way, my second reference above is from a JavaWorld article, The Java classfile lifestyle, which (despite being over 10 years old) provides a very interesting and accessible overview of the .class file structure.

A more technical version can be found in the JVM Spec.
[ January 23, 2007: Message edited by: marc weber ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java version of .class file
 
Similar Threads
Selenium RC
import the java project using ANT in eclipse
java.sql.SQLException: No suitable driver
Jar Hell Resolution
Executable Jar