Servlets and WebServer SetUp

Servlets and the JavaWebServer SetUp

General

Once the JavaWebServer and the JSDK are downloaded and installed, and the PATHS and CLASSPATHS are set, then you can test the WebServer.

To launch the Web Server, either at the command line or in a DOS window do the command

jserv -nojre

the -nojre means do not use the java runtime environment that came with the server, but rather use the version of java under JAVA_HOME
It should tell you some information about your version of the server and then it is up and running. However, you see nothing happen.

You know when the Webserver actually works if you open a Netscape browser and use the URL http://localhost:8080
an example of what it should look like if it worked. Note at the bottom of that link, access to additional utilities

Once on, to stop the web server, you need to get into the administration tool. You can do this by the URL http://localhost:9090 log in using admin and admin, and then Shutdown

SUNs

At Chico, on the Suns, the servlet software is installed (the SDK) is under The JavaWebServer is under /opt/javawebsvr

Your .profile should be modified to include:

export JAVA_HOME=/opt/java
export JSERV_HOME=/opt/javawebsvr
export JSERV_LIB=/opt/javawebsvr/lib
PATH=$PATH:/opt/javawebsvr/bin;export PATH
CLASSPATH=./:/opt/javawebsvr/servlet-class/servlet.jar:/opt/javawebsvr/lib/jsp.jar:/opt/javawebsvr/lib/x509v1.jar;export CLASSPATH
Note: The server is running on the local SUN machine named mycin. You can look at the server running through your browser on your local machine by giving the URL of the machine on which the server is running. (Example http://mycin.ecst.csuchico.edu:8080).

I currently have the Register.html file in the /opt/javawebsvr/public_html directory and Register.class in the /opt/javawebsvr/servlets directory. You can see it run from your browser from the URL
http://mycin.ecst.csuchico.edu:8080/Register.html
You can remotely log onto the machine to put your html and servlets in the proper directories for the server to see them.

Be aware that anything you put in the public_html or servlets directory under /opt/javawebsvr/ should be removed by you after testing your stuff so that it does not fill up space (and for privacy of your code). These are symbolically linked from the /opt/javawebsvr/ directories to /n/projects/javawebsvr directories so the webServer can see them but you can still have write permissions. You should remember to remove your stuff when finished with your session

Windows

In OCNL, the Java Web Server and Servlets package is available on the PC's in OCNL 133 and 251.

For my own (or your own) machine:
The SUN Web Server download page says NT but it works fine for Windows 98
(I tried and it worked)

Make sure you download it in a directory that does not have a space in its name (e.g., My Documents, Program Files) Java does not like this space (as UNIX does not as well - always make your work as cross-platform as possible)

After downloading and installing

I edited my autoexec.bat to include:
SET JSERV_HOME=C:\JavaWebServer2.0
SET JAVA_HOME=C:\jdk1.3
PATH=C:\jdk1.3\bin;c:\JavaWebServer2.0\bin
SET CLASSPATH=.;C:\JSDK2.0\lib\jsdk.jar;C:\JavaWebServer2.0\lib\x509v1.jar;C:\JavaWebServer2.0\lib\jws.jar
All works fine and dandy

Good luck

Tutorial in WebServer download (note: all links are not valid)