I am assuming that all files are stored in a directory named "dynamic". The source code for this example is complete and "dynamic" directory has the following files:

  • TDInterface.java
  • TDServerImpl.java
  • TDApplet.java
  • TDClient.html

Note

In this example, no security manager is installed in the server code. To constrain the server, you can add a security manager in the server code.


Start the server and client

There are four tasks to complete in this section:

Move the files to the deployment directory
Start the Java web server.
Start the server application.
Run the applet.

 

Move the files to the deployment directory

Move the "dynamic" folder to the JaveWebServer\public_html\ folder. Move the TDClient.html file to JaveWebServer\public_html folder.

 

Starting the Java Web Server

c:\JavaWebServer\bin>httpd.exe

 

Starting the Server Application

Running this example requires a bit more setup than the previous examples. When starting the server, the java.rmi.server.codebase property must be specified, so that the stub class can be dynamically downloaded to the registry and then to the client. The following command shows how to start the TDServerImpl server, specifying the java.rmi.server.codebase.

c:\JavaWebServer\public_html\dynamic>java

-Djava.rmi.server.codebase=http://localhost:8080/dynamic/ TDServerImpl


If you have an extra system, we really need that. Unable to compile!!!


To compile without getting irritated, you must give a space just after the word "java" and just before the word "TDServervImpl". To get help, you can also view the RunServer.bat file in the examples\dynamic directory.


If the server is successfully started, it will print the messages "Creating server object" and "server is ready".


Note

localhost is a special IP address. 8080 is the port number on which the web server is running. The codebase is specified as http://yourserver.com:port/directoryname/

 

 

 

RMI BOOK MAIN PAGE                Top

  
Copyright © 2001 www.universalteacher.com