lrxw
lrxw

Reputation: 3866

Automatic start of jconsole from eclipse

I wondered if there is a plugin or someone has a script to start jconsole automatically when I run or debug an application from eclipse. Maybe adding the classpath too. I googled but didnt find anything. In most cases this is a sign that it doesnt work or its to easy to ask :D

Upvotes: 2

Views: 12666

Answers (2)

Kanagavelu Sugumar
Kanagavelu Sugumar

Reputation: 19270

This is not about automatic start, but it is about connecting the program running in eclipse through jvisualvm.

In eclipse, in the Main class java file do the below, then run as java application.

Right click --> Run As --> Run Configuration --> Arguments --> VM argumanets --> Add the below

-Djava.rmi.server.hostname=hostname -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=10001

Then open java visaul vm from JDK bin directory. In that

File --> Add JMX Connection --> In connection text box --> localhost:10001 

This will start your profiling now.

Upvotes: 2

JB-
JB-

Reputation: 2670

There is a plugin for VisualVM (http://visualvm.java.net/eclipse-launcher.html) which does exactly this.

Given that VisualVM is a superset of the jConsole and it also supports jConsole plugins natively you can safely use VisualVM instead of jConsole.

Upvotes: 5

Related Questions