Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Duplicated Java runtime options : what is the order of preference?

Considering the following command line

java -Xms128m -Xms256m myapp.jar 

Which settings will apply for JVM Minimum memory (Xms option) : 128m or 256m ?

like image 239
fabien7474 Avatar asked Apr 29 '10 20:04

fabien7474


People also ask

Where do I put JVM options?

jvmoptions file. For a ZIP distribution, the file is located in the <YouTrack installation directory>/conf directory. Edit the JVM options directly in the file.

What does following JVM args represent?

JVM arguments are flags that are passed to the Java Virtual Machine at the time the application is launched. On Linux or Mac machines, they can be provided through the JAVA_OPTS setting in the whd.conf file.

How do I change java options in Linux?

Editing the Java Options File from the Command Line: Open the Terminal program (CTRL+ALT+T). Open the Java Options file in a text editor (such as nano) by typing the following command: sudo nano /etc/opt/fusion/java. options . Then press Enter.

Which property helps to configure on Java arguments?

7.1 Configuring the Default JVM and Java Arguments. The directory server provides a means of configuring the Java Virtual Machine (JVM) and Java options for each command-line utility and for the directory server itself. The Java configuration is provided in a properties file, located at instance-dir/OUD/config/java.


1 Answers

As always, check your local JVM's specific implementation but here is a quick way to check from the command line without having to code.

> java -version; java -Xmx1G -XX:+PrintFlagsFinal -Xmx2G 2>/dev/null | grep MaxHeapSize  java version "1.8.0_25" Java(TM) SE Runtime Environment (build 1.8.0_25-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode) uintx MaxHeapSize         := 2147483648        {product} 

So you'll see in this case, the second instance of the argument (2G) is what takes precedence (at least in 1.8) and that has been my experience with most other modern versions as well.

like image 200
David Hergert Avatar answered Sep 18 '22 05:09

David Hergert