Back
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?
You can do it programmatically like below:
@Testpublic 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"));}
@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_171.7.0_17-b02C:\workspaces\Oracle\jdk1.7\jreOracle Corporationhttp://java.oracle.com/C:\workspaces\Misc\Miscellaneous\bin; ...
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.
31k questions
32.8k answers
501 comments
693 users