Reputation: 66921
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: 1925
Reputation: 1390
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