Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

determining which version of java

 
Sunny Gibbony
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 Tamirisa
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here you go to find the java version.
1) Open command prompt.
2) type in .
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15641
47
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Prasad Tamirisa
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 51436
87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 51436
87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, Ulf. The list is incomplete, but there is a 2nd link to where you can find the rmissing bits.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic