Linux Commands

How Do I Change the JVM Parameters in Linux

“JVM or Java Virtual Machine is a specification that offers a runtime environment in which a user can execute Java bytecode. JVM has multiple parameters or arguments a user passes to the JVM while launching the application.

These parameters are also known as flags provided by the JAVA_OPTS setting option in a whd.conf file. Hence, changing the JVM parameters in Linux can give you high accessibility for JVM.

So if you want to learn how to change the JVM parameters, please read our guide. In this guide, we will explain the ways to configure JVM parameters in Linux.”

How to Change the JVM Parameters in Linux?

Configuring JVM parameters requires some knowledge about Java and JDK installed in your system. So please install JDK before moving to further steps.

First, let’s get the information about the parameters running of the JVM running in the system by executing the following command

jps -lvm

Now list the JVM parameters available but remember that you can not change all the available parameters:

java -XX:+PrintFlagsFinal -version|grep manageable

As you can see in the above image, the system has listed all the available parameters for JVM.

For changing any parameter, you need to use the jinfo command with the PID of Java running in the system. So here is the command you can use for changing the JVM parameters:

jinfo -flag +<parameter_name> <PID>

In the above command, please replace the parameter_name with the JVM parameter you want to change and PID with Java PID.

If you want to check the PID number of Java but don’t know how to do it, then please run the following command:

Ps -ef | grep java

Moreover, the jinfo doesn’t give permanent modifications to the JVM parameters. When you restart the system, all the changes will revert to their original state. Please make changes again after the restart, or else you will not be able to perform a process as per the requirements.

Wrapping Up

In Linux, you can configure and change the JVM parameters according to your requirements. However, it is best to use a proper method to change these parameters; otherwise, it can cause multiple errors.

That’s why we have written this guide to give you brief information about how to modify JVM parameters in Linux. Please don’t get confused between parameters and arguments because both of these are the same in JVM.

About the author

Prateek Jangid

A passionate Linux user for personal and professional reasons, always exploring what is new in the world of Linux and sharing with my readers.