GeeCON Prague 2014*
The moose likes Java in General and the fly likes javaw and javaw Detection from within Program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "javaw and javaw Detection from within Program" Watch "javaw and javaw Detection from within Program" New topic
Author

javaw and javaw Detection from within Program

Tom Angioletti
Greenhorn

Joined: Jun 25, 2001
Posts: 10
How can a running java program detect whether java.exe or javaw.exe was used to launch it?
Brian Pipa
Ranch Hand

Joined: Sep 29, 2003
Posts: 299
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


My Java Freeware:<br />MACCC - <a href="http://maccc.pipasoft.com" target="_blank" rel="nofollow">http://maccc.pipasoft.com</a><br />Nator - <a href="http://nator.pipasoft.com" target="_blank" rel="nofollow">http://nator.pipasoft.com</a>
Tom Angioletti
Greenhorn

Joined: Jun 25, 2001
Posts: 10
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/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javaw and javaw Detection from within Program