Program to know the version of java and the OS used.

Code:

public class FindVersion

{
public static void main(String[] args)
{
java.util.Properties props = System.getProperties();
System.out.println(“OS: ” + props.get(“os.name”)
+ ” ” + props.get(“os.version”));
System.out.println(“Java: ” + props.get(“java.vendor”)
+ ” ” + props.get(“java.version”));
String classpath = “” + props.get(“java.class.path”);
String ide;
if (classpath.contains(“bluej”))
ide = “BlueJ”;
else
ide = “Unknown”;
System.out.println(“IDE: ” + ide);
}

Output:

OS: Mac OS X 10.9.2
Java: Oracle Corporation 1.7.0_45
IDE: BlueJ

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s