File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Classpath issues Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "Classpath issues" Watch "Classpath issues" New topic
Author

Classpath issues

Bruce Wingate
Ranch Hand

Joined: Feb 16, 2001
Posts: 32
I have set my classpath to "c:\jdk1.3;." and tried to compile what should be a textbook "hello world" servlet.
When I compiled it using "javac HelloWorld.java", I got a lot of errors like "import javax.servlet.*;" not found. These looked like classic Classpath problems, but I triple checked the class path, and it is correct. When I compile with "javac -extdirs c:\jdk1.3 Hello.java" it works no problem.
Any ideas? I'm going to reboot again and try redoing everything.
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040

Bruce:
You need servlet.jar in your class path. Actually something that includes the javax.servlet package.
Easiest way I would suggest is to use Tomcat. Pl. search
this forum for Tomcat instructions and any one thread can
help you.
I am not sure why you are comparing HelloWorld.java and
Hello.java. Are they the same programs or are they different?
regds.
- satya

Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
Bruce Wingate
Ranch Hand

Joined: Feb 16, 2001
Posts: 32
The file name mix-up was just a typing error in my message.
I'm running JRun at home instead of Tomcat, but that should not affect the compiling if the jar with the servlet info is in the path. (In my case, the javax.servlet stuff is in jsdk.jar, which is in the jdk1.3 directory.) My regular java programs compile fine, and the src.jar is also in the jdk1.3 directory.
Any other suggestions?
Geoff Tate
Ranch Hand

Joined: Feb 06, 2001
Posts: 55
Don't you have to explicitly name the .jar on the classpath?

<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR> fantastic, a towel? <HR></BLOCKQUOTE>
 
 
subject: Classpath issues
 
Threads others viewed
cannot find [filename].java
Problem in compiling HelloServlet.java
Trying to find javax, to compile Tomcat servlet
Pls Help!
JDK Installation Question
jQuery in Action, 2nd edition