Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (9.5k points)

I have a Java windows application that runs on a client machine. Can anyone tell me how to check whether a required JRE is installed on the machine by Java program? 

1 Answer

0 votes
by (19.7k points)

 You can do it programmatically like below: 

@Test

public void javaVersion() {

    System.out.println(System.getProperty("java.version"));

    System.out.println(System.getProperty("java.runtime.version"));

    System.out.println(System.getProperty("java.home"));

    System.out.println(System.getProperty("java.vendor"));

    System.out.println(System.getProperty("java.vendor.url"));

    System.out.println(System.getProperty("java.class.path"));

}

The output will be: 

1.7.0_17

1.7.0_17-b02

C:\workspaces\Oracle\jdk1.7\jre

Oracle Corporation

http://java.oracle.com/

C:\workspaces\Misc\Miscellaneous\bin; ...

Interested in Java? Check out this Java Certification by Intellipaat.   

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...