在Eclipse IDE中运行的Java程序的退出代码? [英] Exit code of Java program running inside of the Eclipse IDE?

查看:341
本文介绍了在Eclipse IDE中运行的Java程序的退出代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 如果(veryBadError),我正在开发使用Eclipse的Java程序,该程序应该根据特定条件退出不同的代码){
Runtime.getRuntime()。exit(10);
} else if(notSoBadError){
Runtime.getRuntime()。exit(5)
} else {
Runtime.getRuntime()。exit(0)
}

目前,我从命令行手动运行该程序,然后检查退出状态,这是非常慢的。有没有办法找出退出代码而不离开Eclipse IDE?



提前感谢帮助!

解决方案

在Eclipse中,如果打开调试透视图,您应该看到执行结果(无论是使用运行目标还是调试目标)。您应该看到一个类似于以下内容的条目:

 < terminated,exit value:10> / usr / local / bin / java(2011年6月9日下午4:00:00)

你的退出代码应该是退出值。


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!

解决方案

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".

这篇关于在Eclipse IDE中运行的Java程序的退出代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆