I am looking at some java classes but i'm not sure which version of java it was written in. I don't know if its java se 1.4 or 1.5 etc...
Is there a definate way to find out which version of java the code is written in?
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35258
7
posted
0
Not really. But you can find out which version of the class file format was used - that's generally a clue which Java version they were intended for. The bytes #6 and #7 of the class file provide this hint: http://en.wikipedia.org/wiki/Class_(file_format)
Prasad, that tells you which version of Java is the default used on your system, but it does not tell you if a Java source file was written for Java 1.4, Java 5 etc. or with which version of Java a class file was compiled.
that tells you which version of Java is the default used on your system
Agreed. Apologies for my mistake.
Anyway, I have an another way to do it. Type in the following command in the command prompt.
This will give a BIGGGGGGGGGGGGGG list of bla bla bla bla. Take the major and minor versions from the output. This is not all .... You may need to do some more work to search in sun release notes for the corresponding major and minor versions. [ May 17, 2008: Message edited by: Prasad Tamirisa ]
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32712
4
posted
0
Yes, you are right. I never knew that. I am getting major version 50 and minor version 0 and I know 50 is Java6 (1.6.0). Unfortunately I don't know where to find a list of all version numbers. I think they started about 45.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35258
7
posted
0
Unfortunately I don't know where to find a list of all version numbers. I think they started about 45.
The link I posted above has such a list.
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32712
4
posted
0
Thank you, Ulf. The list is incomplete, but there is a 2nd link to where you can find the rmissing bits.