Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exit code of Java program running inside of the Eclipse IDE?

Tags:

I am developing a Java program using Eclipse that should exit with different codes based on the specific conditions.

if(veryBadError){
    Runtime.getRuntime().exit(10);
}else if(notSoBadError){
    Runtime.getRuntime().exit(5)
}else{
    Runtime.getRuntime().exit(0)
}

Currently I manually run this program from command line and then check exit status, which is ridiculously slow. Is there a way to find out exit code without leaving Eclipse IDE?

Thanks in advance for help!

like image 831
Dima Avatar asked Jun 09 '11 20:06

Dima


1 Answers

In Eclipse, if you open up the "Debug Perspective" you should see the result of your execution there (whether you use a Run target or a Debug target). You should see an entry that looks something like:

<terminated, exit value: 10>/usr/local/bin/java (Jun 9, 2011 4:00:00 PM)

Your exit code should be the value after "exit value".

like image 52
spdaley Avatar answered Oct 12 '22 14:10

spdaley