This section provides a tutorial on how to run 'jps' to connect to a remote 'jstatd' server with a RMI URL to list all JVM processes on the remote machine.
With the "jstatd" server running on my local machine as described in the previous section,
now I am ready to test how to connect to this "jstatd" server with the "jps" command from a remote machine
to list JVM processes.
1. Run my test Java program PrimeNumberSeeker.java in another command window
on my local machine:
2. Run the "jps" command to connect to the "jstatd" server with the "rmi://localhost" URL
as the host identifier:
C:\herong>\Progra~1\java\jdk1.6.0_02\bin\jps -l -m -v rmi://localhost
RMI Registry not available at localhost:1099
Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused: connect
3. The cause of the error is obvious, the "jstatd" server started
the internal RMI registry at the port 1234, not the default port 1099.
So Run the "jps" command again with the "rmi://localhost:1234":