views:

231

answers:

2

Hello All,

I working on a Java based application which can be carried around by the user in a USB flash Drive. At the startup I want to check for existing JVMs on the machine the USB is plugged-in.

How can I achieve it ???

+2  A: 

Investigate JSmooth -- http://jsmooth.sourceforge.net/ -- or Java Web Start in newest Java 6.

http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/cdinstall.03.06.html

Thorbjørn Ravn Andersen
Thank you very much for providing the links.
Sushant Taneja
+1  A: 

Isn't this a chicken-and-egg situation?

Your Java program needs to be launched in a JVM before it can run its logic to look for JVMs. And at the point it can look, a JVM has already been found so I don't think you could do anything particularly useful with it. (Unless your "main" app is actually a tiny bootstrapper, which chooses the JVM it wants and uses Runtime.exec to launch the real application.)

In any case, I would suggest that it's not the responsibility of the application to choose which JVM it wants to run in; the user will set up his environment to run with the JVM he wants, and I'd consider it rude to ignore this and force your own choice on him (which is likely to be made with less knowledge about the relative merits of those JVMs).

Andrzej Doyle
I totally agree with you. But how can I create a native code for different types of OS which checks for JVM installation. If found runs the application, if no JVM exists then displays error message ??
Sushant Taneja
You say you agree with me; but then you go and contradict the entirety of my post. My point was "you shouldn't and can't (easily)." Are you *sure* you agree with me? :-)
Andrzej Doyle