java如何知道你是否正在运行javaw.exe与java.exe [英] java how to know if you're running javaw.exe vs. java.exe

查看:426
本文介绍了java如何知道你是否正在运行javaw.exe与java.exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以编程方式从java查找绝对java.exe路径代码有没有办法知道你运行的java进程是作为java.exe与javaw.exe一起启动的?

Related to Find absolute java.exe path programatically from java code is there any way to know if the java process you're running was started as "java.exe" vs. "javaw.exe"?

谢谢

推荐答案

如果虚拟机没有可用的控制台(比如,因为你用javaw.exe启动它),那么调用 System.console()将返回null。

If the VM has no Console available (say, because you started it with javaw.exe), then a call to System.console() will return null.

编辑:ie,

final boolean amRunningJavaW = System.console() == null;

这篇关于java如何知道你是否正在运行javaw.exe与java.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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