This also does not work, yet works just fine in a command shell. The
error is again that it cannot instantiate the JVM which makes me think
I'm missing something fundamental. Should I be including something I'm
not? The error from XCode is:
Picked up _JAVA_OPTIONS: -Xdebug -Xnoagent
-Xrunjdwp:transport=dt_local,server=y,address=8000
-[NSJavaVirtualMachine initWithClassPath:] cannot instantiate a Java
virtual machine
This does not seem related to the Runtime.exec() call at all, since
when I use:
String cmdarray[] = new String[]{"open", "/Applications/Safari.app"};
I still get the same error:
Picked up _JAVA_OPTIONS: -Xdebug -Xnoagent
-Xrunjdwp:transport=dt_local,server=y,address=8001
-[NSJavaVirtualMachine initWithClassPath:] cannot instantiate a Java
virtual machine
my java app quits "unexpectedly" and yet Safari opens anyway!
I suspect something is fundamentally messed up in your
XCode project. Try building and running a simple test
case from the command line using javac and java, like
this code put into file ExecTest.java:
public class ExecTest {
public static void main (String[] args) {
String cmd[] = { "open", "http://www.apple.com/" };
try {
Runtime.getRuntime().exec(cmd);
}
catch (java.io.IOException iox) {
iox.printStackTrace();
}
}
}
then issue these Terminal commands:
javac ExecTest.java
java ExecTest
This will eliminate XCode and generating an app bundle
from the test. If you still get the "cannot instantiate
a Java virtual machine" error, try the command:
java -version
and if THAT fails, then I'd bet your java install is
hosed, and a clean reinstall of OS X would be in order.
If the ExecTest works without complaint, then the
problem is in your XCode project, or XCode install.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden