First, compile the interface in the file
AgesDB.idl
by executing JavaIDL's
idltojava
command:
setenv JAVAIDL_HOME /users/hplives/JavaIDL-1.1EA setenv PATH $JAVAIDL_HOME/bin:$PATH idltojava -fclient -fserver AgesDB.idlThis command creates a directory called AgesDBApp for the stub and skeleton classes.
We need to compile AgesDBServer.java, the Java application of the middle tier. In order to compile this file, we will need access to the bytecodes of the classes of the JavaIDL API. Earlier, this was done by setting the CLASSPATH variable to include the file $JAVAIDL_HOME/lib/classes.zip. However, for a technical reason (to do with JavaStations), this file will be unzipped, to create two directories in the current directory called com and org. Having done that, we can compile the Java application of the middle tier with a JDK 1.1.x compiler:
javac AgesDBServer.java
Before running the server, we need to start nameserv (JavaIDL's Naming Service program):
nameserv -ORBInitialPort 1050 &The server can then be started using the commands:
setenv CLASSPATH /users/dcl0bjc/public_html/Java:. java AgesDBServer -ORBInitialPort 1050 &
Finally, compile the client program with a JDK 1.0.2 or JDK 1.1.x compiler:
javac AgesDBLet.javaThis compilation will use the JavaIDL classes in the com and org directories that were created earlier. In order to simplify the loading of these classes whenever the Java applet is downloaded, we will use JDK's 1.1.x's jar command to build a Java Archive that contains all of these files:
jar cf AgesDBLet.jar AgesDBLet.class AgesDBApp org comThis Java applet can be run by anyone having a WWW browser that can handle Java Archives. Examples are Netscape's Navigator 3.01 (or later) and JDK 1.1.x's appletviewer:
appletviewer http://perseus.dur.ac.uk/~dcl0bjc/Java/ThreeTier/Ages/AgesDBLet.htmlBecause of an incompatibility, such applets do not work with Netscape's Navigator 4.0x. I have also used this applet as the applet behind one of the buttons on the desktop when using HotJava Views on a JavaStation.