Hi,
Does anyone know a way to relaunch the VM in a system-independent manner?
I've got a problem where I need to get away from the WebStart class-loader and its signing crap and the only way I can see it working is if I relaunch a new VM using something like <a href="
http://java.sun.com/javase/6/docs/api/java/lang/Runtime.html">Runtime.exec()</a>. Apart from getting around webstart, this code would be handy for relaunching the VM to use different Java2D pipeline flags

.
So the code would look something like:
String javaExeName = "java.exe"; // this would only work on windows, anyone know the linux & mac version?
File myJarFile = new File("C:/myJarFile.jar");
String fileSeparator = System.getProperty("file.separator");
String commandString = System.getProperty("java.home") + fileSeparator + "bin" + fileSeparator + javaExeName +" ";
// would the classpath need to be set here? Maybe that would that go like:
// String classPathOption = "-classpath"+" "+"\""+myJarFileName.getParent().getAbsolutePath()+"\"";
// commandString += classPathOption;
commandString += "\""+myJarFile.getAbsolutePath()+"\"";
// I think the above would work so long as the main-class was specified in the manifest file (which is inside the jar).
Runtime.getRuntime().exec(commandString);
Googling the topic hasn't been successful for me but I did find <a href="
http://www.centerkey.com/java/browser/">this (a system-independent way of launching the browser using Runtime.exec())</a>.
If anyone can help with the 'javaExeName' variable for other OS's or anything else that would be great.

Thanks,
Keith
PS: I've raised this issue before here:
http://www.java-gaming.org/forums/index.php?topic=14092.15 Also, the below code actually works. It spawns a new VM (on windows) but can't be used from Webstart since the classpath location isn't returned on a webstarted-app.
String fileSeparator = System.getProperty("file.separator");
String commandString = System.getProperty("java.home")+fileSeparator+"bin"+fileSeparator+"java.exe"+" ";
String classPathOption = "-classpath"+" "+"\""+System.getProperty("java.class.path")+"\"";
commandString += classPathOption+" ";
String fullClassName = Main.class.getCanonicalName();
commandString += fullClassName;
Runtime.getRuntime().exec(commandString);
PPS: This is the problem I'm having with webstart:
http://www.java-gaming.org/forums/index.php?topic=15397.0