Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions? | Software Development
 

Java get Version

In this section, you will learn how to obtain the java version and the OS version. We are providing you an example which will obtain the java version installed on the system and the OS version by using the System.getProperty().

Java get Version

                         

In this section, you will learn how to obtain the java version and the OS version. We are providing you an example which will obtain the java version installed on the system and the OS version by using the System.getProperty(). This will provide all the properties of the system.

System.getProperty("java.version")- This will return the java version installed on the system.

System.getProperty("os.version")- This will return the OS version.

Understand with Example

In this example we want to describe you  a program code that helps you to get the java version and the OS version. For this we have a class name 'GetVersion',Inside the main method a string variable  name OSversion and JAVA version that is used to store the java version installed on the system and the OS version by using the System.getProperty ( ) method. The System.out.println is used to display the version of OS and java obtained by the get Property( ) stored in a OSversion and JAVAversion.On execution of the given below code, the command prompt display the version of OS and java.

 

Here is the code of GetVersion.java

class  GetVersion
{
  public static void main(String[] args) 
  {
    String OSversion = System.getProperty("os.version");
        String JAVAversion = System.getProperty("os.version");

    System.out.println("The version of OS is: "+OSversion);
    System.out.println("The version of JAVA is: "+JAVAversion);
  }
}

Output will be displayed as:

Download Source Code

                         

» View all related tutorials
Related Tags: java windows c error orm form diff io dialog icons sed format version window display icon port using log support

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
 
Tell A Friend
Your Friend Name

 

 
Recently Viewed
Software Solutions
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.