import java.io.*;
class NoofJRE {
static String REG_PATH = "reg query HKLMSoftwareJavaSoftJava Runtime Environment";
public static void getJREInfo() {
try {
Process process = Runtime.getRuntime().exec(REG_PATH);
InputStream inputstream = process.getInputStream();
InputStreamReader inputstreamreader = new InputStreamReader(inputstream);
BufferedReader bufferedreader = new BufferedReader(inputstreamreader);
String line;
while ((line = bufferedreader.readLine()) != null) {
System.out.println(line);
}
}catch (Exception e) {
System.out.println("I am in Exception");
}
}
public static void main(String s[]) {
getJREInfo();
}
}
Output
! REG.EXE VERSION 3.0
HKEY_LOCAL_MACHINESoftwareJavaSoftJava Runtime Environment CurrentVersion REG_SZ 1.6
BrowserJavaVersion REG_SZ 1.6.0_01
HKEY_LOCAL_MACHINESoftwareJavaSoftJava Runtime Environment1.6
HKEY_LOCAL_MACHINESoftwareJavaSoftJava Runtime Environment1.6.0
HKEY_LOCAL_MACHINESoftwareJavaSoftJava Runtime Environment1.6.0_01
No comments:
Post a Comment