954,136 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Version output

I've been trying to find a function that returns the version number of the JVM. I found this website that does it, so I know it can be done:

http://www.javatester.org/version.html

Can anyone help me out?

nanodano
Junior Poster in Training
78 posts since Feb 2005
Reputation Points: 36
Solved Threads: 2
 

"java -version" from the command line or System.getProperty("java.specification.version");
From the docs on this system property The requirement to identify the Java Runtime is already partially met via the properties specified by the Java Language Specification, §20.18.7 using java.lang.System.getProperties.java.version i.e. Solaris 1.2
java.vendor i.e. Sun Microsystems Inc.
Currently these identify the implementation of the Java runtime and the core classes that are available. These properties do not identify the Java Language Specification version that this JDK implements.
Additional properties are needed to identify the version of the Java Runtime Environment specification that this implementation adhere’s to. The properties are:java.specification.version i.e. 1.1
java.specification.name i.e. Java™ Language Specification
java.specification.vendor i.e. Sun Microsystems Inc.
These properties are accessed using the method java.lang.System.getProperty and return their values as strings.

Ezzaral
Posting Genius
Moderator
15,985 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You