Java 退出代码和含义

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6454114/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-16 06:05:38  来源:igfitidea点击:

Java exit codes and meanings

javaprocessexit-code

提问by Assaf

Is there a list of exit codes and meanings for java process terminations? Because I have an exit code 23 and i don't know what it can be (I cannot change the log to see the full stack trace because it sits in a different remote server).

是否有 Java 进程终止的退出代码和含义列表?因为我有一个退出代码 23,我不知道它是什么(我无法更改日志以查看完整的堆栈跟踪,因为它位于不同的远程服务器中)。

I browsed it for hours and couldn't find any mentioning of exit code 23.

我浏览了几个小时,找不到任何提及退出代码 23 的内容。

采纳答案by Jesper

In your Java application, when you call System.exit(n);, then the Java runtime environment will return nas the exit code back to the operating system.

在您的 Java 应用程序中,当您调用 时System.exit(n);,Java 运行时环境将n作为退出代码返回给操作系统。

What the number means depends on the program you are running - not Java itself, but the program you are running produces this number. There are no standard numbers. Look in the documentation of the program that produces this exit code to find out what it means.

该数字的含义取决于您正在运行的程序 - 不是 Java 本身,而是您正在运行的程序产生此数字。没有标准数字。查看生成此退出代码的程序的文档以了解其含义。

回答by Mike Kwan

There is no definition for what exit code 23 means. Exit codes have no convention on what the values represent other than that a nonzero status code indicates abnormal termination. Zero indicates success but even then it is completely dependent as to whether the developer adheres to this 'standard'.

退出代码 23 的含义没有定义。除了非零状态代码表示异常终止之外,退出代码没有关于值代表什么的约定。零表示成功,但即便如此,它也完全取决于开发人员是否遵守此“标准”。

回答by Per Lindberg

In another questionthere's a link to a page with JVM exit code explanations. But exit code 23 seems to be mysterious.

另一个问题中,有一个指向JVM 退出代码解释页面的链接。但是退出代码 23 似乎很神秘。

回答by user2179737

I compiled some "standard" exist codes I use across my apps in a enum, the exit codes are based on freebsd sys exits + jvm signaled exits, see SysExits.javafor more detail.

我编译了一些我在枚举中的应用程序中使用的“标准”存在代码,退出代码基于 freebsd sys exits + jvm 信号退出,有关更多详细信息,请参阅SysExits.java

回答by Ceyhun Mamedov

In Eclipse RCP exit code 23 means restart. But it works under IDE only.

在 Eclipse RCP 中,退出代码 23 表示重新启动。但它只能在 IDE 下工作。