Home  >  Article  >  Java  >  How to Enable JMX on your JVM for Access via jconsole?

How to Enable JMX on your JVM for Access via jconsole?

Linda Hamilton
Linda HamiltonOriginal
2024-10-28 08:32:02232browse

How to Enable JMX on your JVM for Access via jconsole?

Activating JMX on JVM for Access via jconsole

Accessing JVM internals using tools like jconsole requires the Java Management Extensions (JMX) to be activated. Follow these steps to enable JMX on your JVM:

Relevant Documentation:

  • [JMX documentation](http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html)

Command Line Parameters:

Start your program with the following parameters:

-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=<port>
-Dcom.sun.management.jmxremote.rmi.port=<rmi port>
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false

Example:

java -Dcom.sun.management.jmxremote \
  -Dcom.sun.management.jmxremote.port=9010 \
  -Dcom.sun.management.jmxremote.local.only=false \
  -Dcom.sun.management.jmxremote.authenticate=false \
  -Dcom.sun.management.jmxremote.ssl=false \
  -jar Notepad.jar

Additional Notes:

  • -Dcom.sun.management.jmxremote.local.only=false: May be necessary on some platforms; if absent, it may result in an access error.
  • -Dcom.sun.management.jmxremote.authenticate=false: Enables access for anyone. Use cautiously.
  • -Djava.rmi.server.hostname=127.0.0.1: May resolve issues with accessing the server in certain cases.

The above is the detailed content of How to Enable JMX on your JVM for Access via jconsole?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn