简体   繁体   中英

java how to know if you're running javaw.exe vs. java.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"?

Thanks

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

edit: ie,

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM