Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java how to know if you're running javaw.exe vs. java.exe

Tags:

java

windows

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

like image 299
rogerdpack Avatar asked Jan 31 '13 18:01

rogerdpack


People also ask

What is the difference between Javaw exe and java exe?

java.exe is the command where it waits for application to complete untill it takes the next command. javaw.exe is the command which will not wait for the application to complete. you can go ahead with another commands.

Do I use java or Javaw?

The javaw command is identical to java, except that javaw has no associated console window. Use javaw when you do not want a command prompt window to be displayed. The javaw launcher displays a window with error information if it fails.

What is Javaw exe in java?

This non-console version of the application launcher is used to launch java applications usually with graphical user interfaces (GUIs). These applications have windows with menus, buttons and other interactive elements.

Why is Javaw exe running?

javaw.exe is a legitimate file from Sun Microsystems. It is an executable file used for displaying error messages, if they occur while installing any application. It's an essential Java file and it is typically located in c:\program by default.


1 Answers

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;
like image 58
Ti Strga Avatar answered Nov 13 '22 15:11

Ti Strga