File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes determining which version of java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "determining which version of java" Watch "determining which version of java" New topic
Author

determining which version of java

Sunny Gibbony
Ranch Hand

Joined: May 14, 2008
Posts: 39
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: 41124
    
  45
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)


Ping & DNS - my free Android networking tools app
Prasad Tamirisa
Ranch Hand

Joined: Mar 26, 2007
Posts: 130
Here you go to find the java version.
1) Open command prompt.
2) type in .


Regards,
Durga Prasad
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

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.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Prasad Tamirisa
Ranch Hand

Joined: Mar 26, 2007
Posts: 130
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: 38033
    
  22
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: 41124
    
  45
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: 38033
    
  22
Thank you, Ulf. The list is incomplete, but there is a 2nd link to where you can find the rmissing bits.
 
 
subject: determining which version of java
 
Similar Threads
JAVA 1.5
will struts 1.1 supports java 6?
Mac-specific applet-Javascript communication problem
in which language java is written
After studying for weeks I just failed the practice exam. What should I study?