'JVM arguments not being passed to java application at run time

I try to give VM parameters (jmx parameters) to run a jar file. For some reason, the VM parameters configured not being passed to the java application at run time (log statement in main method confirms that aswell). Application launches successfully but unable to access jmx service. It all works fine with Intellij though.

JVM_OPTS="-Dcom.sun.management.jmxremote \

-Djava.rmi.server.hostname=localhost \

-Dcom.sun.management.jmxremote.port=8020 \

-Dcom.sun.management.jmxremote.rmi.port=8021 \

-Dcom.sun.management.jmxremote.authenticate=false \

-Dcom.sun.management.jmxremote.ssl=false"

eval "java $JVM_OPTS -Djava.security.egd=file:/dev/./urandom -jar target/shopfront-0.0.1-SNAPSHOT.jar"

I tried to access jmx via visual vm but I am unsuccessful. Version: Java 11

I expect to access jmx via visual client

Any help is appreciated!



Solution 1:[1]

The above script works fine. It is bash script

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ratna