Lesson documents: http://artcontext.org/edu/topics/java/server To unpack the server.tar use: tar -xvf server.tar httpServer.java produces two class files: * httpServer.class * httpHandler.class The first forms the main loop that listens for connections to a (specified) port. You must edit the httpServer.java file to change the port number to a high value (greater than 1000) that will not conflict with other servers. Don't forget to modify the DocumentRoot variable in the source code, too. This should be the path of the web folder contained in the server.tar distribution. Each time a browser makes a request for a document, as for example with the URL: http://class.sva.edu:1234/index.html The httpServer.class will respond by creating a new "thread" using httpHandler.class as its script. Among the things that are done in the httpHandler.class: * Parsing the request from the browser such as - filename - HTTP request - HTTP version - Posted content length to read (if any) * Opening a file and loading its contents in a memory buffer * Responding to the browser with a header and file data * Sending an informative message to the server's console In order to compile the .java file, you will need to use the "javac" command (at the terminal prompt). The location of this program may not be included in the list of default folders that contain executable programs (your shell command interpreter refers to this list as your "path"). There is a javac program here: /usr/bin/javac If you type that, the command interpreter (c-shell) will find the java compiler and use it to convert the source code to class files -- something like machine language. After compiling the .java file, you will need to run the program. To start a java program, use the "java" runtime program. It can be found, similarly, the /usr/bin/ folder: /usr/bin/java httpServer