2

I am trying make make a process java program, and it is going just fine. The problem is that it create a java icon, even if there's nothing to show. I tried to use the "Dapple.awt.UIElement=true" or "Djava.awt.headless=true", But truth is: I do not know how to implement those since i'm not that mac friendly... Any help would be great!

user3342795
  • 105
  • 3
  • 6
  • 1
    It's possible this has changed, but you could take a look at [this](http://stackoverflow.com/questions/8246766/how-to-hide-the-java-swt-program-icon-in-the-dock-when-the-application-is-in-the) and [this](http://stackoverflow.com/questions/17460777/stop-java-coffee-cup-icon-from-appearing-in-the-dock-on-mac-osx). As of Java 7 some of the JVM properties may no longer be supported – MadProgrammer May 26 '14 at 21:11
  • The mac I am using is java 1.6, so it should be fine...? – user3342795 May 26 '14 at 21:12
  • I have looked at those post before writing my question, And I still don't know how to use those – user3342795 May 26 '14 at 21:13
  • If you're using java 6 you "should" be able to use the JVM arguments, but, if you're running the jar/program directly, then you need to set this up yourself, typically through a shell script, for example – MadProgrammer May 26 '14 at 21:20

1 Answers1

1

In your Java code, in main(), add this:

System.setProperty("java.awt.headless", "true");

It's unclear what you mean by:

"Djava.awt.headless=true"

The "D" is used to set properties at the command-line. For example:

java -Djava.awt.headless=true -jar myProg.jar
martinez314
  • 12,162
  • 5
  • 36
  • 63