How to detect JRE when it is not registerd in registry? Is there any solution?
A:
Not in Java, there isn't. If no JRE is set up, Java code won't run. You could conceivably CD to the JRE's location and start it up yourself, but at that point you already know it's there anyway.
Another language could check for JRE folders in the most common places (in Windows, IIRC, \Program Files\Java is the default). If you have a way of running Java code, it could do the same thing...but again, the ability to even run Java code implies the presence of a JRE of some kind.
If you just want the app to see what version of JVM it's running in, System.getProperty("java.version")
should tell you that. Doesn't seem too helpful, though.
cHao
2010-05-29 11:26:56