2

In this tutorial I read about this command- -Djava.awt.headless=true From text I don't understand role of this command. In Tomcat's documentation I didn't find anything about it. Where should I use and enter it?

Iga
  • 323
  • 1
  • 4
  • 18

1 Answers1

4

If you execute the following command:

java -h

You can see the help of the java command.

And you can find that:

[...]

-D<name>=<value> set a system property

[...]

So it means that you defined a new system property with name java.awt.headless and value true.

You can find some additional information related to this variable (java.awt.headless) on this link where is stated that:

You can also use the following command line if you plan to run the same application in both a headless and a traditional environment:

java -Djava.awt.headless=true

Note:

Headless mode is a system configuration in which the display device, keyboard, or mouse is lacking. Sounds unexpected, but actually you can perform different operations in this mode, even with graphic data.


Set system properties on tomcat.

If you have tomcat 7 you can edit the following file

<TOMCAT DIRECTORY>/conf/catalina.properties

and add the property java.awt.headless. Also other versions of tomcat can use the same file to set a system property.

Davide Lorenzo MARINO
  • 26,420
  • 4
  • 39
  • 56
  • I used command java -Djava.awt.headless=true and got a help-list with the link to javaSE documentation.http://postimg.org/image/6aqdmnemp/ I think there is somthing worng... – Iga Jun 13 '16 at 14:57
  • The command java needs at least a class or an executable jar to start. -D= simply adds a parameter, but the command need to be completed – Davide Lorenzo MARINO Jun 13 '16 at 14:58
  • @lga that is because it's not a command by itself - you have to also at least specify the name of the class that you want to run. Example: `java -Djava.awt.headless=true com.mypackage.MyProgram` – Jesper Jun 13 '16 at 14:59
  • now I understand. but what class should I specify in order to start Tomcat's JVM with the command line(how it is written in the guide, which was shown in my question)? – Iga Jun 13 '16 at 15:19
  • Which version of tomcat are you using? – Davide Lorenzo MARINO Jun 13 '16 at 15:20