开发者

Java based usb application

开发者 https://www.devze.com 2022-12-11 02:09 出处:网络
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-

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 ???


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


If you wrap the program in an .exe wrapper - as Launch4j - it can check for JVM installation, before each execution.


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).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号