wood burning stoves 2.0*
The moose likes Servlets and the fly likes ClassPath Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "ClassPath" Watch "ClassPath" New topic
Author

ClassPath

Thomas Richards
Greenhorn

Joined: Mar 20, 2005
Posts: 7
Hi im making an HttpServlet. Need to import the following:

import java.io.*;
import javax.servlet.*;
import javax.servlet.ServletRequest;
import javax.servlet.http.*;

How do i add them to the class path? Or can i just add them to the jre somewhere?

PS i know where the .jar file is

Wrong forum i expect (sorry!) Help please
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12759
    
    5
Compiling and running servlets are two different things when it comes to Classpath. Tomcat completely ignores your Environment CLASSPATH settings.

The compiler needs to be directed to the servlet.jar (sometimes called servlet-api.jar or servlet-impl.jar).

In my opinion, using Ant to control compilation is the best way to juggle classpaths while keeping your environment variables simple. Yes there is a learning curve with Ant but you will be glad you did.

Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ClassPath
 
Similar Threads
a question about exceptions
importing classes into java programs
The import javax.mail cannot be resolved
Parsing XML (jsp/struts/apache environment)
Using HashMap