System.exit(0)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gaya3
    New Member
    • Aug 2007
    • 184

    System.exit(0)

    Hi,
    "System.exit(0) "-->It means that it terminates the currently running Java Virtual Machine with "0" as status. what does that "status" refers to?
    Even its working for System.exit(2) or for any status value.. could anyone clear that? Thanks in advance

    -Thanks & Regards,
    Hamsa
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by gaya3
    Hi,
    "System.exit(0) "-->It means that it terminates the currently running Java Virtual Machine with "0" as status. what does that "status" refers to?
    Even its working for System.exit(2) or for any status value.. could anyone clear that? Thanks in advance

    -Thanks & Regards,
    Hamsa
    The API Specs are your friend.

    Comment

    • gaya3
      New Member
      • Aug 2007
      • 184

      #3
      Originally posted by r035198x
      The API Specs are your friend.

      Thank u.. yes.. Its mentioned as "status".I would like to know "status of what"

      -Thanks & Regards,
      Hamsa

      Comment

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #4
        Originally posted by gaya3
        Thank u.. yes.. Its mentioned as "status".I would like to know "status of what"

        -Thanks & Regards,
        Hamsa
        The entry also tells you to see the entry for Runtime.exit which is called by System.exit ...

        Comment

        • JosAH
          Recognized Expert MVP
          • Mar 2007
          • 11453

          #5
          Originally posted by gaya3
          Hi,
          "System.exit(0) "-->It means that it terminates the currently running Java Virtual Machine with "0" as status. what does that "status" refers to?
          Even its working for System.exit(2) or for any status value.. could anyone clear that? Thanks in advance

          -Thanks & Regards,
          Hamsa
          It is the return value from the entire process. You can test it using "errorlevel "
          on a Windows box or using "status" on a Unix box. Traditionally 0 means a
          successful exit and any other value should indicate a failure of some sort.
          Standard C only allows for the values 0 and 1 for a success or failure across
          different platforms. Most Windows people seem to ignore this capability by
          not returning anything at all from their "main()" method and even making it
          a void function (in C or C++). If the main() function in Java doesn't explicity
          uses the exit() method 0 is assumed, i.e. a successful termination of the process.

          kind regards,

          Jos

          Comment

          • gaya3
            New Member
            • Aug 2007
            • 184

            #6
            Originally posted by JosAH
            It is the return value from the entire process. You can test it using "errorlevel "
            on a Windows box or using "status" on a Unix box. Traditionally 0 means a
            successful exit and any other value should indicate a failure of some sort.
            Standard C only allows for the values 0 and 1 for a success or failure across
            different platforms. Most Windows people seem to ignore this capability by
            not returning anything at all from their "main()" method and even making it
            a void function (in C or C++). If the main() function in Java doesn't explicity
            uses the exit() method 0 is assumed, i.e. a successful termination of the process.

            kind regards,

            Jos

            Thanks Jos!

            -Thanks & Regards,
            Hamsa

            Comment

            Working...