How to detect Java VM

Is there a way to find out whether there's a Java VM or Java Runtime is istalled in Windows?
[107 byte] By [dbh] at [2007-9-30 8:42:33]
# 1

Do you mean the Java SDK or Java JRE is installed?

What you may be looking for is tools.jar . Unless it is in you class path, you won't know the difference.

try {

Class.forName("sun.tools.javac.Main");

System.out.println("We have tools.jar in our path");

} catch (ClassNotFoundException e) {

System.out.println("The jar tools.jar not found");

}

Another option is to look at System.out.println(System.getProperties().list());

to see if this has want you looking for.

Peter-Lawrey at 2007-7-2 19:50:38 > top of Java-index,Administration Tools,Sun Connection...
# 2

Run the follwoing code then you will find the files installed

import java.net.InetAddress;

class classpath {

public static void main(String args[]) {

System.out.println("List of all Classes in the class path");

Object clspath = System.getProperties();

System.out.println(clspath.toString());

System.out.println("List of all Classes in the class path" + "\n");

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

}

}

ShivaKatula at 2007-7-2 19:50:38 > top of Java-index,Administration Tools,Sun Connection...
# 3
Peter-Lawrey and ShivaKatula,Thanks much for the suggestion. Buf if you don't have Java to begin with, how would you run the suggested code?
dbh at 2007-7-2 19:50:38 > top of Java-index,Administration Tools,Sun Connection...
# 4
At a Windows command prompt type java -versionNo reply means no jvm.
GaryEMason at 2007-7-2 19:50:38 > top of Java-index,Administration Tools,Sun Connection...
# 5
Actually I meant, if there is no jvm, you won't get a version response you'll get "unrecognized internal or external command" message from the dos vm.
GaryEMason at 2007-7-2 19:50:38 > top of Java-index,Administration Tools,Sun Connection...
# 6
Thanks much for the information!
dbh at 2007-7-2 19:50:38 > top of Java-index,Administration Tools,Sun Connection...