wood burning stoves 2.0*
The moose likes Java in General and the fly likes Returning error code from jar application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic
Author

Returning error code from jar application

Makesh Kumar Ramakrishnan
Ranch Hand

Joined: Jan 07, 2006
Posts: 88
I am not sure, you came across the similar situation or there is a solution for this problem.

I need to return an error code from my jar application to the calling application. This jar application does some core java functionality and if it finds any unusal situation while executing the code, then it returns with the error code to the calling function. The calling function may be a unix shell script.

Can I use System.exit(n) to return the error code? Can this return value be received by the calling function? Please let me know your answers

Thanks,
Makesh


Makesh<br /> <br />SCJP | SCWCD | SCBCD | SCEA
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Please do not crosspost.
Thanks.

http://www.coderanch.com/t/327972/java/java/Returning-error-code-jar-application


[My Blog]
All roads lead to JavaRanch
Makesh Kumar Ramakrishnan
Ranch Hand

Joined: Jan 07, 2006
Posts: 88
I am sorry. I don't know the exact level of difficulty of the question. that's why i posted in both forum.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

I think that you can check the status code returned by System.exit in Unix, using an environment variable.
It may depend on the shell (I don't remember), but I think you can get it with $?
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

CLosing, continue in the other copy.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Returning error code from jar application