Article View: borland.public.jbuilder.java.language
Article #19371Re: Exit codes, values?
From: Joe C. Hecht
Date: Sun, 08 Feb 1998 00:00
Date: Sun, 08 Feb 1998 00:00
28 lines
1493 bytes
1493 bytes
Q) Application.Main does not return anything. How do I pass back
an exit code to the process that started my application?
A) You can call the exit() method of the Runtime class. Note that
this will terminate the currently running Java Virtual Machine.
If there is a security manager, its checkExit() method will be
called with the code you are attempting to pass back. This
of course may result in a security exception. If all goes well,
the call to exit() will shut down the currently running Java
Virtual Machine and the exit() method will not return.
JBuilder Example:
// exit, and pass the number 10 as an exit code
Runtime.getRuntime().exit(10);
//Batch file example
@ECHO OFF
java untitled1.application1
IF ERRORLEVEL 10 ECHO Java App Error #10
--
Joe C. Hecht
joehecht@gte.net
(850) 689-0877 121 Louise Dr. Crestview, FL 32536
http://home1.gte.net/joehecht/index.htm
Technical Details
Message-ID:
<6bltck$c9t12@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<6aif2n$r744@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,2dda1bca56b203a3 X-Google-Attributes: gidf74b3,public From: "Joe C. Hecht" <joehecht@gte.net> Subject: Re: Exit codes, values? Date: 1998/02/08 Message-ID: <6bltck$c9t12@forums.borland.com> X-Deja-AN: 323310112 Content-Transfer-Encoding: 7bit References: <6aif2n$r744@forums.borland.com> Mime-Version: 1.0 Reply-To: joehecht@gte.net To: Adam Stiles <adam@dpssoft.com> Content-Type: text/plain; charset=us-ascii Organization: Offshore Technology Newsgroups: borland.public.jbuilder.java.language