Home Step 04 Step 06

Remote debugging tutorial

This tutorial is a feature of JBuilder Enterprise.

Step 5: Starting the RMI Registry and server on the remote computer

This step tells you how to start the RMI registry on the remote computer and start the server in debug mode on the remote computer. You need to be aware of the RMI settings as well as the debug settings in the Java command line that starts the server.

To start the RMI registry on the remote computer,

  1. Open a DOS window.

  2. Change to the Jdk1.3\bin folder.

  3. Start the RMI Registry by entering the following command:

         start rmiregistry

    The RMI Registry starts in a separate process. If the registry does not start, you may be out of available memory. Exit other applications that may be running, close the DOS window or command shell and try again.

To start the server on the remote computer,

  1. Start a Command window. The Java command line is more than 256 characters; you will not be able to run it in a standard Windows 4DOS or 4NT window. Start the Command window from the Start menu: click Run and enter command. For NT computers, enter cmd.

  2. Make sure the Jdk1.3\bin folder is in your path.

  3. Go to the root of the folder that contains the RMI sample.

  4. Enter the following command at the prompt. This command will start the server in debug mode and suspend its execution. You may want to place the command in a batch file or shell script. If you do, make sure the command contains no line breaks.
    java -classic -Xdebug -Xnoagent -Djava.compiler=NONE -Djava.rmi.server.codebase=file:/rmi/classes/ -Djava.security.policy=file:/rmi/SimpleRMI.policy -Xrunjdwp:transport=dt_socket,server=y,address=5000,suspend=n -classpath d:\rmi\classes com.borland.samples.rmi.SimpleRMIServer
    

  5. This command line takes both RMI and debugger arguments. A description of each parameter follows.

    Command line RMI and debugger arguments

    Parameter Description
    java The command to run the Java VM.
    -classic Instructs the debugger to use the classic VM instead of the HotSpot VM.
    -Xdebug Runs the VM in debug mode.
    -Xnoagent Do not use debug agent.
    -Djava.compiler=NONE Do not use any JITs.
    -Djava.rmi.server.codebase=
    file:/rmi/classes/
    Identifies the location of the server's class files.
    -Djava.security.policy=
    file:/rmi/SimpleRMI.policy
    Identifies the location of the java security policy file.
    -Xrunjdwp:transport=dt_socket,server=y,
    address=5000,suspend=y
    Debugger options, where:
    • transport: The transport method. Needs to match what is set on the Runtime Properties Debug page for the server - see Step 2 of this tutorial.
    • server: Run the VM in server mode.
    • address: The port number through which the debugger communicates with the remote computer. Needs to match what is set on the Runtime Properties Debug page for the server - see Step 2 of this tutorial.
    • suspend: Indicates whether the program is suspended immediately when it is started.
    -classpath d:\rmi\classes The class path.
    com.borland.samples.rmi.SimpleRMIServer The runnable server file (includes the package name).

In the next step, you'll use the debugger to attach to this running server and step into the server's getDate() method where the cross-process breakpoint was set.

Home Step 04 Step 06