System.console()从Eclipse返回null,但可以通过命令提示符进行操作 [英] System.console() returns null from Eclipse but fine with Command Prompt
问题描述
当我使用Eclipse Helios的System.console时,它总是返回null。
When I use System.console from Eclipse Helios, it always returns null.
但是,当我直接在命令行中使用它(即从命令提示符手动编译并执行Java源代码)时,我确实获得了Console对象。
However, when I use it directly from command line (i.e. compiling and executing a java source code manually from command prompt), I do get a Console object.
要知道为什么会这样,所以我检查了此链接。据此,当我从Eclipse运行Java代码时,后台作业调度程序必须正在启动我的JVM。这是什么意思?
To know, why this happens I checked this link. According to it, when I run my Java code from Eclipse, a background job scheduler must be starting my JVM. What does this mean?
从命令行启动我的JVM有何不同?
And how differently is my JVM started when I start it from command line?
我还检查了此链接。 McDowell在这里说cmd.exe是一个控制台设备。因此,我再次感到困惑的是,这到底是控制台设备吗?
I also checked this link. Here McDowell says that cmd.exe is a console device. So then I am again confused that exactly is a console device?
推荐答案
因为它是一个错误#122429
这篇关于System.console()从Eclipse返回null,但可以通过命令提示符进行操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!