Home  >  Article  >  Java  >  How to Enable JMX on a JVM for Remote Access with jconsole?

How to Enable JMX on a JVM for Remote Access with jconsole?

Susan Sarandon
Susan SarandonOriginal
2024-11-02 11:58:30910browse

How to Enable JMX on a JVM for Remote Access with jconsole?

Activating JMX on a JVM for jconsole Access

Accessing a JVM remotely with jconsole requires enabling Java Management Extensions (JMX) on the JVM. To do so, start the program with the following parameters appended to the command:

-Dcom.sun.management.jmxremote: Enables remote JMX access.
-Dcom.sun.management.jmxremote.port=9010: Specifies the port for remote JMX access (default: 9010).
-Dcom.sun.management.jmxremote.local.only=false: Allows connections from remote hosts (optional).
-Dcom.sun.management.jmxremote.authenticate=false: Disables authentication for remote access (not recommended for production environments).
-Dcom.sun.management.jmxremote.ssl=false: Disables SSL for remote access.

For 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 Considerations:

  • -Dcom.sun.management.jmxremote.local.only=false is not always required, but it may be necessary on Ubuntu.
  • -Djava.rmi.server.hostname=127.0.0.1 may need to be set to resolve connection issues in certain scenarios.
  • Disable authentication (-Dcom.sun.management.jmxremote.authenticate=false) with caution as it allows unrestricted access to the JVM.

The above is the detailed content of How to Enable JMX on a JVM for Remote Access with 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