Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Beginning Java and the fly likes Servlet compilation/loading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Servlet compilation/loading" Watch "Servlet compilation/loading" New topic
Author

Servlet compilation/loading

Vinnie Jenks
Ranch Hand

Joined: Apr 26, 2004
Posts: 207
I'm on windows XP and I'm using tomcat 5.0.28 as my jsp/servlet server.

I simply want to compile and run a servlet but I'm having problems that I'm sure are related to the classpath env variable.

I bought the book "core Servlets and JavaServer Pages" by Marty Hall & Larry Brown and I'm following the instructions for setting up a servlet that uses packages, however, it doesn't work.

I set my CLASSPATH variable to tomcat's "servlet-api.jar" file and also set a value for the directory I'm developing the app in which is "webapps/myapp" in the tomcat install dir.

I put a servlet called "Index.java" into the myapp/WEB-INF/classes directory and attempted to compile using "javac Index.java" while in the above-mentioned directory...and I get errors telling me "javax.servlet.* does not exist" and "javax.servlet.http.* does not exist" and it of course goes on to fail anywhere I reference a class belonging to those packages.

What am I doing wrong?

Thanks!
Ramaswamy Srinivasan
Ranch Hand

Joined: Aug 31, 2004
Posts: 295
Hi Vinnie...

Regarding you post, it could have been in the Servlets forum.Any way,
it will be moved there by the bartenders.

Regarding your problem, I would like to ensure whether you have the
servlet-api.jar in the Tomcat\Commons\lib Folder.

Ensure that.

Also check whether all the necessary Environment Variables are set in
your system. They are mandatory for smooth running of Tomcat, otherwise
he is troublesome.

If you would like to have a look on the Environment Variables,
have a look
At This post, where you may find some info about the Environment Variables.

Try those...That should help you.

Cheers,
Swamy
 
wood burning stoves
 
subject: Servlet compilation/loading