How to determine Java bytecode version

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Samuel Jackson

    How to determine Java bytecode version

    Howdy,

    I'm trying to figure out what bytecode version a given class was
    compiled with. I've tried looking at the actual .class file, but that
    didn't pan out.

    Is there a utility to determine versions?

    thanks!

    Sam
  • Anthony Borla

    #2
    Re: How to determine Java bytecode version


    "Samuel Jackson" <sami_jackson@h otmail.com> wrote in message
    news:223bb155.0 311251251.2a80c [email protected] gle.com...[color=blue]
    > Howdy,
    >
    > I'm trying to figure out what bytecode version a given class was
    > compiled with. I've tried looking at the actual .class file, but that
    > didn't pan out.
    >
    > Is there a utility to determine versions?
    >[/color]

    Every '.class' file starts off with the following:

    * Magic Number [4 bytes]
    * Version Information [4 bytes]

    A hexdump of a '.class' file compiled with each of the following options
    reveals:

    javac -target 1.1 ==> CA FE BA BE 00 03 00 2D
    javac -target 1.2 ==> CA FE BA BE 00 00 00 2E
    javac -target 1.3 ==> CA FE BA BE 00 00 00 2F
    javac -target 1.4 ==> CA FE BA BE 00 00 00 30

    Perhaps you could use this information to write your own '.class' file
    version checking utility, using Java, or perhaps a scripting or shell
    language ;) !

    I hope this helps.

    Anthony Borla

    P.S.

    If requiring more information just do a Google search for ".class file
    format" or "Java Bytecode Tutorial"


    Comment

    Working...