Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Defautl Port For JVM?

 
ranua agarwal
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Is there any api/command to get the port for running jvm on local machine?
What is the default port for the JVM?

Thanks,
Ranu.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15369
40
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean with the "port for the JVM"? Do you mean a TCP/IP port number? As far as I know, the JVM does by default not listen on any network ports.
 
ranua agarwal
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jasper,

I am writting code for JMX to fetch CPU utilization.
To connect with remote machine, we need to pass the "url" to
JMXConnector, in this form--
JMXServiceURL url = new JMXServiceURL(
"service:jmx:rmi:///jndi/rmi://102.57.63.10:8686/jmxrmi");

Here 8686 is the port for jvm, and thus i asked the qyestion.
 
Rob Spoor
Sheriff
Pie
Posts: 20552
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html
 
Henry Wong
author
Marshal
Pie
Posts: 21216
81
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

By default, for the JVM, JMX connectors are *not* turned on -- so the "default" port of the JMX connector will depend on how you turned it on (which may also depend on what JMX implementation you are using).

Henry
 
Campbell Ritchie
Sheriff
Pie
Posts: 49457
64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not a "beginning" question. Moving thread.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic