Re: Exit Value = 35584 from Java.lang.Process



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



Relevant Pages

  • Re: Delete/Entry=### fails to stop job execution
    ... >>have done the default ON ERROR THEN EXIT handling and run down the ... >>batch job with. ... Terminating Executing Batch Jobs ... command procedures would normally exe- ...
    (comp.os.vms)
  • Re: Delete/Entry=### fails to stop job execution
    ... The DELETE/ENTRY command appears to be doing a force ... I would think it should also delete process that is executing the command ... Or use ON ERROR to jump to an exit routine. ...
    (comp.os.vms)
  • Re: How do I get a batch file to exit?
    ... Batch files terminate automatically after executing ... The command "Exit" is unnecessary. ...
    (microsoft.public.windowsxp.general)
  • Re: Problems installing XP SP2!
    ... package source directory and make sure the that XPSPS2sms.exe file exists in ... in your SMS Program command line property. ... > Executing program as a script ... > OnOptionalExecutionRequests failed for program Automated upgrade from XP ...
    (microsoft.public.sms.admin)
  • Re: Windows update error 0x80242008
    ... 2.219: Hotfix started with following command line: /si ... Unexpected Error While Executing Line 1 ( ... Test.IE7InstallBlock.Section) of PreRequisite ...
    (microsoft.public.windowsupdate)