![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to get the exit status | yhacks | Shell Programming and Scripting | 1 | 05-19-2008 05:06 AM |
| Running Shell Script from Java | Asty | Shell Programming and Scripting | 3 | 08-14-2006 06:08 AM |
| checking exit status of a shell script | kdipankar | Shell Programming and Scripting | 2 | 05-08-2006 10:08 PM |
| exit unix, but says running jobs | yls177 | UNIX for Dummies Questions & Answers | 6 | 10-25-2002 12:08 AM |
| How to find the exit status of last command in Unix? | rajugp1 | High Level Programming | 1 | 09-10-2002 08:52 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
exit status running java classpath in unix shell
I have a java classpath running inside of a unix shell script. During my testing it will error with lines that show an example like this below.
java.io.FileNotFoundException error at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:129), which I know why I get that error, but when I set in my unix shell script this to see the right exit status of success/fail, it always shows a 0 for success when that isn't really the case. Below is the two lines I have set to capture the exit status and just display that exit status for now. notifycode=$? echo $notifycode I have these 2 lines above on a line right below my java command in my unix shell script. How can I get my unix shell script to capture any error exit status during my shell script? |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Your problem doesn't have anything to do with the shell's error handling/reporting. If your java command will exit(0) even on a failure, then that's what the script will report. You need to check and confirm that your java command is exiting with the correct error code on failure.
|
|
#3
|
|||
|
|||
|
Quote:
To return an exit code you would need to call the following in the exception handler. Code:
static void java.lang.System.exit(int status); |
|||
| Google The UNIX and Linux Forums |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|