Friday, February 4, 2011

Add JVM options to Glassfish

I want to add a JVM option to Glassfish, so that when it will always start with the JVM option. Let's just say I want to add the below JVM option:


-Djava.awt.headless=true


2 ways to do it:


Glassfish Admin Console
By using the Glassfish Admin Console, we can easily add the required option. Just:

  1. go to http://my.glassfish.url:4848/ (the default port is 4848),
  2. login
  3. on the left select "Application Server"
  4. select the tab "JVM Settings"
  5. select the sub-tab "JVM Options"
  6. add your option there

XML Config
Go to the following Glassfish path on the file system:
/my/path/to/glassfish/domains/domain1/config
and edit the file domain.xml. Within that XML is an element called <java-config>. Within that element, add a child <jvm-options> with the option like so:

        <jvm-options>-Djava.awt.headless=true</jvm-options>

Done.


No comments:

Post a Comment