Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how can i know the verison of my java

 
saikrishna cinux
Ranch Hand
Posts: 689
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Virag Saksena
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java.lang.System.getProperty("java.version")
 
Chetan Parekh
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Type java -version on Command Prompt
 
saikrishna cinux
Ranch Hand
Posts: 689
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 181
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic