Re: Exit Value = 35584 from Java.lang.Process
- From: Danger_Duck <ganggang3ster@xxxxxxxxx>
- Date: Wed, 13 Aug 2008 13:30:52 -0700 (PDT)
On Aug 13, 4:08 pm, Owen Jacobson <angrybald...@xxxxxxxxx> wrote:
On Aug 13, 2:17 pm, Danger_Duck <ganggang3s...@xxxxxxxxx> wrote:
So I have a method that includes a few lines that will create a batch
file and run it using Java.lang.Process, but lately I've gotten a
mysterious return value:
Process proc = Runtime.getRuntime().exec(binDirectory + "temp.bat");
Wait, wait, hold on.
Runtime.exec *does not* invoke a command processor. It's a wrapper
around CreateProcessEx (on Windows) or fork+exec (on *nix), not around
system(). So you can't just blithely pass it a script unless the
underlying process creation primtives know how to cope. In the case
of CreateProcessEx, it *cannot* launch batch files - it needs a
command interpreter to do that.
You want to run the following:
exec ("cmd", "/C", binDirectory + "temp.bat");
(NOT "cmd /C " + binDirectory + "temp.bat", as this will blow up if
binDirectory contains spaces.)
Of course, Things Are Different on *nix - there's no cmd command, and
exec() can usually cope with scripts just fine. This is one of the
many ways using native tools can completely torpedo portability in
Java...
May be unrelated to the issue I'm trying to solve where for some
reason I cannot call a constructor in my class
(NoClassDefFoundError), but I'm curious as to what this means.
The Sun Javadoc only tells me that 0 is the normal value while a
google search is most unhelpful. I'm ever-hopeful that someone here
can explain what's going on.
Even that's only a convention. The return code from
Process.exitValue() dictated entirely by the newly created process;
zero-means-success is a common convention but is by no means required.
-o
Exit Value issue resolved-it's returning 0 once again:
All I did was rebuild the project which recreated an executable which
the batch file was executing.
TheNoClassDefError is unrelated to the exit value and just happened to
coincidentally appear the same time. I'm still working on it, but it
has something to do with trouble accessing external classes for a .jar
I put into eclipse....yeah total tangent.
So anyway, for anyone curious, someone informed me that:
"abnormal exit: exit code=35584 typically implies problems in the
path to the executable or the path to something required by the
executable."
.
- References:
- Exit Value = 35584 from Java.lang.Process
- From: Danger_Duck
- Re: Exit Value = 35584 from Java.lang.Process
- From: Owen Jacobson
- Exit Value = 35584 from Java.lang.Process
- Prev by Date: Re: Exit Value = 35584 from Java.lang.Process
- Next by Date: Re: Exit Value = 35584 from Java.lang.Process
- Previous by thread: Re: Exit Value = 35584 from Java.lang.Process
- Next by thread: Re: Exit Value = 35584 from Java.lang.Process
- Index(es):
Relevant Pages
|