Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Beginning Java and the fly likes how can i know the  verison of my java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how can i know the  verison of my java " Watch "how can i know the  verison of my java " New topic
Author

how can i know the verison of my java

saikrishna cinux
Ranch Hand

Joined: Apr 16, 2005
Posts: 689
how can i get the information of java installation properites in mysystem..
and if there are 2 versions installed in my system (jdk1.4 and jdk1.5)
then how can i get both the version's installed in my system
can i get the program in java or otherwise suggest me which class should i need tot use to get the properties of the system.???(to know the version of java)
thanx in advance
cinux


A = HARDWORK B = LUCK/FATE If C=(A+B) then C=SUCCESSFUL IN LIFE else C=FAILURE IN LIFE
SCJP 1.4
Virag Saksena
Ranch Hand

Joined: Nov 27, 2005
Posts: 71
java.lang.System.getProperty("java.version")


<a href="http://www.auptyma.com" target="_blank" rel="nofollow">The Peak of Performance</a>
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
Type java -version on Command Prompt


My blood is tested +ve for Java.
saikrishna cinux
Ranch Hand

Joined: Apr 16, 2005
Posts: 689
Originally posted by Chetan Parekh:
Type java -version on Command Prompt


I mean to ask about how to get thru programming code not on cmd promt


any way thanx
cinux
Tauri Valor
Ranch Hand

Joined: Aug 03, 2005
Posts: 166
As Chetan said you can use:

System.out.println(java.lang.System.getProperty("java.version"));

it returns your java version.

You can install more than one jdk on your system, but as far as I know you can use only one at a time by setting the classpath of the one you wanted to work with.


cheers,
Su Yeu


A Moment's insight is sometimes worth a Life's experience.
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
Originally posted by Su Yeu:
As Chetan said you can use:

System.out.println(java.lang.System.getProperty("java.version"));

it returns your java version.

You can install more than one jdk on your system, but as far as I know you can use only one at a time by setting the classpath of the one you wanted to work with.


cheers,
Su Yeu


The classpath has nothing to do with which version of Java that you use. However, setting the PATH will make it so you can easily run one of the installed versions by just typing the commands "javac" and "java". You can always type the complete path to run the version you wish at any time.

Layne


Java API Documentation
The Java Tutorial
 
Consider Paul's rocket mass heater.
 
subject: how can i know the verison of my java