I'm doing an assignment for University that requires us to make a servlet. I haven't been able to start it yet as I am having trouble compiling the java files. I started of in Linux but could not get Tomcat working so I've resorted to Windows XP. I now have Tomcat installed which is a step in the right direction but there are still problems... I have made a test file to see if it is all working (just a simple Hello World Java servlet). I then go to the Windows command prompt and try to compile it using javac helloWorld.java and 7 errors get spit out into the prompt window. I have Java EE installed but the errors look like it cant find the Java directory. Anyone mind helping me out? because I cant get on with my assignment.

Thank you

Errors in command prompt:

7 Years
Discussion Span
Last Post by peter_budo
  1. You should have developing environment set specifically for this, as loose files that can be tolerated for small desktop development are bad idea in web development
  2. When you compile you need to include direction for servlet-api.jar that can be found in Tomcat_dir/lib. Execution command should look something like javac -classpath c:\Tomcat6.0.20\lib\servlet-api.jar test.java

It would be good idea if you checked your library for copy of the book Head First Servlets & JSP 2nd edition


Thanks, I already have the book. Are you suggesting the book helps with this as I've skimmed through it and had no luck. Am I right in declaring an environment variable for this by editing PATH? This is what I have:
C:\Program Files\Java\jdk1.6.0_17\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;c:\Program Files\Microsoft SQL Server\90\Tools\binn\


That is funny because in my book on pg.81 is something like this ;)
And yes PATH declaration is correct, but it is also good idea to set another environment variable JAVA_HOME with the location to Java installation but without \bin

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.