Remote debugging tutorial
This tutorial is a feature of JBuilder Enterprise.
Step 2: Setting runtime and debug configurations
In this step, you will set runtime and debug configurations for the client and server. Using preset parameters saves you time when running and debugging, because you need to set the parameters only once. With preset configurations, each time you run or debug your application you simply select the desired configuration. To set the configurations for this tutorial, you use the dialog boxes listed in the following table.
Dialog boxes for setting client and server runtime and debug configurations
Dialog box page |
Applies To |
Description |
Run page (Runtime Properties dialog box) |
Server |
Configures the run parameters for the RMI server. |
Debug page (Runtime Properties dialog box) |
Server |
Configures how the server on the client computer attaches to the remote server process. |
Run page (Runtime Properties dialog box) |
Client |
Configures the run parameters for the RMI client. |
Note: You don't need to change settings on the Run or Debug pages of the Project Properties dialog box. You only need to change them on the Run and Debug pages of the Runtime Properties dialog box.
To set runtime configurations for the server,
- Choose Run|Configurations. The Runtime Configurations dialog box is displayed.
- Choose the configuration called
Windows Run SimpleRMIServer
.
- Press Edit to display the Run page of the Runtime Properties dialog box.
- Adjust the parameters passed to the Java VM. At the beginning of the VM Parameters field, enter the following command followed by a blank space:
-classic
This argument instructs the debugger to use the classic VM instead of the HotSpot VM.
- Make sure the VM Parameters codebase argument points to the location of the server class files. In a typical Windows installation, this will be the
classes
folder in the samples\RMI
folder:
-Djava.rmi.server.codebase=file:C:\JBuilder40\samples\RMI\classes\
Note: The last backslash in the argument, after the classes
entry, is required.
- Make sure the security policy argument in the VM Parameters field points to the location of the security policy file. The policy file specifies the rights of the RMI server to listen for and accept RMI client requests over a network. In a typical Windows installation, this will be the
samples\RMI
folder.
-Djava.security.policy=file:C:\JBuilder40\samples\RMI\SimpleRMI.policy
- Make sure the main class is set to:
com.borland.samples.rmi.SimpleRMIServer
- When you're finished, the Run page for the server should look similar to this:
To set the remote debugging configuration for the server,
- Click the Debug tab.
- Click the Enable Remote Debugging option and then the Attach option.
- Enter the name of the computer where the server will be running in the Host Name field.
- Leave the Transport Type as
dt_socket.
- Enter the address of the remote computer in the Address field. You will be using this number again when you run the server on the remote computer (Step 5 of the tutorial). For the purposes of this tutorial, leave this set to
5000.
- When you're finished, the Debug page for the server should look similar to this:
- Click OK to close the Runtime Properties dialog box for the server.
Next, you'll set runtime configurations for the client.
- In the Runtime Configurations dialog box, choose the configuration called
Windows Run SimpleRMIClient
.
- Press Edit to display the Run page of the Runtime Properties dialog box.
- Adjust the parameters passed to the Java VM. At the beginning of the VM Parameters field, enter the following command:
-classic
This instructs the debugger to use the classic VM.
- Make sure the remaining argument in the VM Parameters field points to the location of the security policy file. In a typical Windows installation, this will be the
samples\RMI
folder.
-Djava.security.policy=file:C:\JBuilder40\samples\RMI\SimpleRMI.policy
- Make sure the main class is set to:
com.borland.samples.rmi.SimpleRMIClient
- In the Application Parameters field, enter the name of the remote computer. This is the name you entered into the Host Name field of the Debug page of the Runtime Properties dialog box for the server (see the previous section).
- When you're finished, the Run page for the client should look similar to this:
- Click OK to close the Runtime Properties dialog box.
- Click OK again to close the Runtime Configurations dialog box.
In the next step, you will set the breakpoints for the client and the server.