• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

javaw and javaw Detection from within Program

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can a running java program detect whether java.exe or javaw.exe was used to launch it?
 
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Tom Angioletti
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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/
reply
    Bookmark Topic Watch Topic
  • New Topic