wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Getting Version Numbers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Getting Version Numbers" Watch "Getting Version Numbers" New topic
Author

Getting Version Numbers

Chiranjeevi Kanthraj
Ranch Hand

Joined: Feb 18, 2008
Posts: 288

Hi All


I need to read the Version number of the Java, MySQL which the application is using is their any other way then reading registry.

so that should work in Linux also.

If you have any idea please help me


-Chiru
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 9990
    
    7

System.getProperty("java.version") will give you the JRE version. Is that what you are looking for or did I misunderstand the question?


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Chiranjeevi Kanthraj
Ranch Hand

Joined: Feb 18, 2008
Posts: 288

Ya this what i want.. Thanks.

Can we use same for the MySql?
Gurjit Sandhu
Greenhorn

Joined: Jan 29, 2009
Posts: 11
Hi
i tried
System.out.println(System.getProperty(("java.version") );
but it gives out null.

I am using window xp and jdk 1.6. follow steps to get version no :

1) in command prompt go to jdk 1.6 installation directory : example
c:\program files\java\jdk1.6.0_03>

2) type javac -version
c:\program files\java\jdk1.6.0_03>javac -version

it outputs : javac 1.6.0_03

3) or type java -version
c:\program files\java\jdk1.6.0_03>java -version

it outputs : java version "1.6.0_03"
java(TM) SE Runtime environment (build 1.6.0_03-b05)
java hotspot (tm) client VM (build 1.6.0_03-b05,mixed mode,sharing)



Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 9990
    
    7

Chiranjeevi Kanthraj wrote:Ya this what i want.. Thanks.

Can we use same for the MySql?


Sorry. No idea abt MySQL. I am DB challenged
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 9990
    
    7

Gurjit Sandhu wrote:Hi
i tried
System.out.println(System.getProperty(("java.version") );
but it gives out null.


Strange.
Works for me.
I get "1.6.0_10" on the console.
Can you please double check your code and see if there is any typo?

Please note the property name "java.version" is case sensitive!
Chiranjeevi Kanthraj
Ranch Hand

Joined: Feb 18, 2008
Posts: 288

Maneesh Godbole wrote:
Chiranjeevi Kanthraj wrote:Ya this what i want.. Thanks.

Can we use same for the MySql?


Sorry. No idea abt MySQL. I am DB challenged


i got
execute the query "select version()" it will give that
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting Version Numbers
 
Similar Threads
Clipboard functionality
SCBCD 5 Dilemma
Downloading IBM Websphere
Not a valid 32 bit application
scjp 1.6