When developing Java OSS and closed libraries in-house, I received such inquiries several times, so if I write it in Qiita at least, I think that it will solve itself by google. With a faint expectation.
The library documentation says that specifying -Dxxxx = yyyy
enables the xxxx
option, but it doesn't work. Is the library buggy?
When launching a jar using the built-in tomcat (or Jetty, etc.), I've added -Dcom.sun.management.jmxremote
and other JMX options to enable JMX, but even if I launch the application JMX port does not become LISTEN.
Do you need to adjust the parameters of the built-in Tomcat (or Jetty, etc.)?
Wrong command
java -jar zzzz.jar -Dxxxx=yyyy -Dcom.sun.management.jmxremote
At first glance, it looks like there is no problem, but it is as follows.
Correct command
java -Dxxxx=yyyy -Dcom.sun.management.jmxremote -jar zzzz.jar
In short, it's about specifying the JVM argument after the -jar
option: sweat:
By the way, with the java -help
command, the order is clearly stated. Needless to say, [options]
is the JVM option and [args]
is the command line argument that the program handles.
$ java -help
how to use: java [options] <mainclass> [args...]
(When executing a class)
Or java[options] -jar <jarfile> [args...]
(When executing a jar file)
Or java[options] -m <module>[/<mainclass>] [args...]
java [options] --module <module>[/<mainclass>] [args...]
(When running the main class of a module)
Or java[options] <sourcefile> [args]
(When running a single source file program)
Main class, source file,-jar <jarfile>、
-m or--module <module>/<mainclass>The arguments that follow are as arguments to the main class
Will be passed.
...Below, abbreviated
JVM option doesn't work! ?? In that case, first check the command you typed before doubting others.
Recommended Posts