For this lab assignment we will use Java Development Kit 1.3.
Check if you have Java installed: java -version
. If not,
install it with:
module initadd prog/jdk/1.3.1_02
You will now be able to use Java next time you log into your computer.
API Documentation
javac Hello.java
. This results in Hello.class
.
java Hello
JSDK 2.0 is installed in ~trapo/JSDK2.0
. Let the Java interpreter know where JSDK is located by setting the environment
variable CLASSPATH:
setenv CLASSPATH .:/home/trapo/JSDK2.0/src
You might set the CLASSPATH in your .cshrc file so that you don't have to set it each time you work with servlets.
Copy all the servlet examples and the servlet.properties
file in the directory created for the third lab assignment:
/home/<user>/TDDB37/lab2% cp /home/trapo/JSDK2.0/examples/* .
Compile all of the examples to make sure your java environment is sane:
/home/<user>/TDDB37/lab2% javac *.java
We will not use Appache to execute the servlets. Instead, we will use a "servlet runner" provided with the JSDK. You can find details
about the servletrunner
in the "Servlet Tutorial" appendix.
The documentation for the servlet packages is available from http://www.ida.liu.se/~TDDB37/labs/apidoc/packages.html
.
A typical development session of a servlet looks like this:
<your-servlet>.java
<your-servlet>.class
file
servlet.properties
file and add your servlet
~trapo/JSDK2.0/bin/servletrunner -d
/home/<user>/TDDB37/lab2/ -s
/home/<user>/TDDB37/lab2/servlet.properties
http://localhost:8080/servlet/<your-servlet>
, for example
http://localhost:8080/servlet/SnoopServlet?param1=1¶m2=2
.