Changing HotSpot VM Option using 'jinfo'

This section provides a tutorial example on how to set a new value to a HotSpot VM option on a given JVM process using the 'jinfo' tool.

The "jinfo" tool can be used to view the current value of any HotSpot VM option of a given JVM process as described in the previous section.

The "jinfo" tool can also be used set a new value of any HotSpot VM option using the "jinfo -flag name=value" format. Here is what I did to test this function with JDK on a Windows system:

C:\herong>\Progra~1\java\jdk1.8.0\bin\java -XX:ThreadStackSize=512
   -jar "\Program Files\java\jdk1.8.0\demo\jfc\Notepad\notepad.jar"
   (Notepad started)

(Start another command window.)
C:\herong>\Progra~1\java\jdk1.8.0\bin\jps -l -m

1424 \Program Files\java\jdk1.8.0\demo\jfc\Notepad\notepad.jar
3124 -l -m

   -flag ThreadStackSize 1424


   -flag ThreadStackSize=1024 1424
Exception in thread "main" 
   Command failed in target VM

Apparently, the target VM (the Notepad VM) does not allow me to change its option. I do not know why?

Last update: 2015.

Table of Contents

 About This Book

 Java Tools Terminology

 Installing Java 8 on Windows

 'javac' - The Java Program Compiler

 'java' - The Java Program Launcher

 'jdb' - The Java Debugger

 'jconsole' - Java Monitoring and Management Console

 'jstat' - JVM Statistics Monitoring Tool

JVM Troubleshooting Tools

 JVM Troubleshooting Tools in JDK 1.5

 'jinfo' - VM Option Value Checker

Changing HotSpot VM Option using 'jinfo'

 'jstack' - Stack Tracer to Generate Thread Dump

 What Is a Thread Dump?

 Java Thread Deadlock Demo Program

 Detecting Java Thread Deadlocks with 'jstack'

 'jmap' - JVM Heap Dump Tool

 Printing Histogram of Java Object Heap

 Generating Heap Dump File with 'jmap'

 'jhat' - Java Heap Analysis Tool

 Starting 'jhat' Web Server on a Heap Dump File

 Listing Instance Counts of All Classes

 Browsing Object Instance Values

 Object Query Language (OQL)

 Searching for Instances with OQL Statements

 jvisualvm (Java VisualVM) - JVM Visual Tool

 'jar' - The JAR File Tool

 'javap' - The Java Class File Disassembler

 'keytool' - Public Key Certificate Tool

 'native2ascii' - Native-to-ASCII Encoding Converter

 Outdated Tutorials


 PDF Printing Version