This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
    Bookmark Topic Watch Topic
  • New Topic

Returning error code from jar application

 
Makesh Kumar Ramakrishnan
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not crosspost.
Thanks.

http://www.coderanch.com/t/327972/java/java/Returning-error-code-jar-application
 
Makesh Kumar Ramakrishnan
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
CLosing, continue in the other copy.
 
    Bookmark Topic Watch Topic
  • New Topic