Forums Register Login

javaw and javaw Detection from within Program

+Pie Number of slices to send: Send
How can a running java program detect whether java.exe or javaw.exe was used to launch it?
+Pie Number of slices to send: Send
I'm not sure that you can. Why do you need to know this? Maybe we can offer an alternate way of doing whatever it is you are trying to do.
Brian
+Pie Number of slices to send: Send
Nevermind, I found a way to do it:

import javax.swing.*;
public class TestJavaw
{
public static void main(String[] args)throws Exception
{
System.out.println("Test");
System.out.flush();
JOptionPane.showMessageDialog(null, "check="+System.out.checkError(), "check", JOptionPane.ERROR_MESSAGE);
}
}
checkError returns true if run under javaw and false if run under java.
I found the suggestion via Google here
http://www.geocrawler.com/archives/3/196/1998/5/0/1082544/
The glass is neither half full or half empty. It is too big. But this tiny ad is just right:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 864 times.
Similar Threads
Hiding DOS window with Swing GUI
javaw?
Annoying DOS window
Launching a Java app from the desktop.
closing the command window on program launch
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 06:37:20.