Your application can be started with following JMX parameter.
-Dcom.sun.management.jmxremote.port=12345
Or
You can set System property as JMX port as follows to enable JMX monitoring.
System.setProperty("com.sun.management.jmxremote.port", 12345);
Then, use VisualVM to monitor your application. You can monitor CPU, Memory, Threads etc using this VisualVM tool.
https://visualvm.github.io/
For more information visit :-
https://dzone.com/articles/java-memory-and-cpu-monitoring-tools-and-technique