File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes What is the diff between System.Exit(0) or System.Exit(1) or System.Exit(Any Number) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "What is the diff between System.Exit(0) or System.Exit(1) or System.Exit(Any Number)" Watch "What is the diff between System.Exit(0) or System.Exit(1) or System.Exit(Any Number)" New topic
Author

What is the diff between System.Exit(0) or System.Exit(1) or System.Exit(Any Number)

UdayK Kumar
Greenhorn

Joined: Aug 05, 2009
Posts: 26

Can you please let me know...

What is the diff between System.Exit(0) or System.Exit(1) or System.Exit(Any Number) in Java?



Uday
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Have you read the javadoc for java.lang.System?
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Here's a teaser:
The Java API wrote:The argument serves as a status code; by convention, a nonzero status code indicates...
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19785
    
  20

The value means nothing for the Java program itself. The shell calling the Java program can use it to determine what to do next.

A small example of how I usually compile Linux programs from source and install them: These are three separate commands:
- ./configure reads my environment settings, and creates a build script (Makefile) based on them
- make uses the instructions in the generated Makefile to actually compile the code into an executable
- make install then installs the created executable into a specified location

The && work similarly to how they work in Java: if ./configure succeeds the shell will call make. If that too succeeds the shell will call make install. If ./configure fails (e.g. because a required library is missing) then the shell will abort and not call the remainder. Failure is usually indicated by a non-0 return (i.e. 0 is good, everything else is bad).


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is the diff between System.Exit(0) or System.Exit(1) or System.Exit(Any Number)