Servlet Configuration  «Prev  Next»

Compiling Java Servlet - Exercise

A text editor

Objective: Confirm your JSDK installation by compiling a servlet.

Scoring

This exercise is worth 1 point. The exercise is auto-scored, which means that all you have to do to receive credit for it is click the Submit button below.

Instructions

  1. Using the text editor you chose in Lesson 4, create a new file and enter this code:
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class Simplest extends HttpServlet {
    // code goes here 
    }
    
  1. Save the file as Simplest.java in any folder you choose.
  2. Set your classpath using this command in an MS-DOS prompt:
set classpath=%CLASSPATH%;c:\jsdk2.1\servlet.jar
  1. From the same prompt, change to the folder where you saved Simplest.java, and compile it.
    If it compiles without errors, you have successfully completed this exercise.