Reputation: 66711
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
Upvotes: 11
Views: 1920
Reputation: 1389
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: i.e.,
final boolean amRunningJavaW = System.console() == null;
Upvotes: 13