Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problem running a native executable
- From: glhenni@xxxxxxxxxxxxx (Gary L. Hennigan)
- Subject: Problem running a native executable
- Date: 30 Aug 1999 15:30:49 -0600
I'm trying to do something very simple, have my Java code execute the
command:
netscape -remote 'openFile(/tmp/file.wrl)'
It works perfectly from the command line, and I can easily invoke
netscape with:
netscape file:/tmp/file.wrl
from my Java code, but put the "-remote ..." in there and it won't
work.
Netscape reacts to it, because I can minimize it before Java invokes
it and it pops up when Java executes it, but netscape beeps and
doesn't do the "openFile()". Here's the Java code snippet I'm using:
// Bring up a picture in Netscape
String cmdLine = "netscape -remote 'openFile(/tmp/file1.wrl)'";
try {
System.out.println("Trying to run:\n" + cmdLine);
Process nsViewer = Runtime.getRuntime().exec(cmdLine);
InputStream nsErr = nsViewer.getInputStream();
int c;
while ((c=nsErr.read()) != -1) {
System.out.println((char)c);
}
nsViewer.waitFor();
System.out.println("Exit value of Netscape was: " +
nsViewer.exitValue());
}
catch (Exception exc) {
System.err.println("Error running geometry viewer!");
System.err.println("Error: " + exc);
}
I never get any output from the processes InputStream (or the
ErrorStream, which I also tried) and the exitValue() always returns 0,
but it doesn't bring the file up.
I suspect something along the line is getting confused by either the
single quotes or the parens but escaping the single quotes with a "\"
yields the same behavior.
If anyone has suggestions they'd be appreciated!
Gary
- Prev by Date: ThreadLocal
- Next by Date: default out stream
- Previous by thread: ThreadLocal
- Next by thread: default out stream
- Index(es):