Search code examples
javaubuntutomcatopencms

What does this command mean and what functions performs?


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?


Solution

  • 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.