Two-tier Example (MCS-270, Spring 2003)


This page describes a version of the HelloWorld RMI example from JavaSoft that I configured for working here. To see the JavaSoft's more detailed explanation, go to the Getting Started link at the their webpage JavaTM Remote Method Invocation (RMI)

Necessary files

Following are the files you need:

Deployment process

Following is the process I go through to get the applet running (assuming that you have the three java files in some source-file directory, and the html file in some accessible place in your www-docs):

  1. First off (and in general for our java stuff), you should be sure that you are running the correct version of java, which is 1.4.0. To see whether this is the case, type the following in a shell:
              java -version
    If that returns 1.4.[any], then all is well. If not, then the best thing to do is to put the following line in your .cshrc file:
              set path=(/usr/java/j2sdk1.4.1_03/bin $path)
    After doing this, you will probably need to start a new shell for doing the rest of this.

  2. Create the directories www-docs and www-docs/codebase in your home directory.
              mkdir ~/www-docs
              mkdir ~/www-docs/codebase

    You also need to make sure that your www-docs directory is readable by others:

              chmod -R a+rX ~/www-docs

  3. Save the three java files above in some source-file directory. Go to that directory and issue the following command to compile the java files to the appropriate directory:
             javac -d ~/www-docs/codebase *.java

  4. Set your classpath:
             setenv CLASSPATH ~/www-docs/codebase

  5. Run rmic to create skeletons/stubs:
             rmic -d ~/www-docs/codebase examples.hello.HelloImpl

  6. Start the server (you must issue this command from the serving computer, which must also have its CLASSPATH set as above):
             java -Djava.rmi.server.codebase= \
        $HOME/www-docs/policy \

  7. Click on the link above for the running version of the applet