Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I provide JVM arguments to VisualVM?

I'm using VisualVM from JDK 1.6.0_26 to profile a Java webapp running under Tomcat, but VisualVM often tells me that it doesn't have enough memory to take a snapshot, and to use the -Xmx switch to provide more memory to Netbeans. The problem is, I'm running VisualVM outside of Netbeans, so how can I provide JVM arguments to jvisualvm.exe?

like image 357
Mike Partridge Avatar asked Mar 05 '12 17:03

Mike Partridge


People also ask

How do I add a JVM argument?

-- Go to the Eclipse Window > preferences, in "Java > Installed JREs". -- Copy the current default JRE with a new name, for example myJRE. -- Select the new JRE and click on the "Edit" button. -- In the "Edit JRE" dialog, add your JVM arguments in the "Default VM Arguments" field.

How does VisualVM connect to remote JVM?

Connecting to a Remote Host To add a remote host, right-click the Remote node in the Applications window, choose Add Remote Host and type the host name or IP address in the Add Remote Host dialog box. (You can also specify a display name that will be used to refer to the host when listed under the Remote node.)

How do I access Java VisualVM?

You can access VisualVM from the bin directory of the JDK: On a Windows system, start VisualVM by double-clicking jvisualvm.exe. You can also select VisualVM from the Start menu (if Windchill shortcuts are installed). On other systems, start VisualVM by invoking the jvisualvm script.

Does VisualVM work with Java 11?

Use VisualVM bundled with GraalVMGraalVM contains a fully compliant Java SE 8, Java SE 11, and Java SE 17 JDK distribution based on Oracle JDK and OpenJDK. It features an innovative JIT compiler which may noticeably improve performance of Java applications, compared to the standard Oracle JDK or OpenJDK.


2 Answers

Should be able to modify the memory settings in %JDK_HOME%\lib\visualvm\etc\visualvm.conf

Xms and Xmx are in the default_options line.

like image 161
Zack Macomber Avatar answered Oct 25 '22 07:10

Zack Macomber


or I think this works too:

jvisualvm.exe -J-Xmx512m (or whatever amount you need)

-J on the .exe command line for onetime settings, or the .conf file noted in the other answer for changing defaults

like image 35
Kevin Welker Avatar answered Oct 25 '22 08:10

Kevin Welker