Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Help needed setting classpath  RSS feed

 
Jaya Santhosh
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am new to servlets and JSP. I have a question regarding setting Classpath. My development directory structure is like this c:\..\desktop\java\project1\src\com\eg\web\e1.java. Servlet.jar file is in C:\Program Files\Apache Group\Tomcat 4.1\common\lib. I tried setting Classpath in windows 2000 using control panel=>System utility by this command
SET CLASSPATH=.;c:\Program Files\Apache Group\Tomcat 4.1\common\lib\servlet.jar . I try to compile my program by going into the whole development directory structure C:\..\src\com\eg\web using javac e1.java. But I get the error "package javax.servlet does not exist". Can somebody help me resolve this?

Thank You in advance
Jaya
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jaya,

This is more of a problem with javac and the setting up of a Java environment so I'm going to move it to Java In General (Beginner) where you will probably get better help.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since the path to servlet.jar has spaces in it, you need to put quotes around the path name in your CLASSPATH variable. In otherwords, you should have


I think this will fix your problem.

Also, does your e1.java file have a package declaration? My guess is that you have something like "package com.eg.web;" at the beginning of this file. If so, then you should only change to the "c:\..\desktop\java\project1\src\" directory when you compile with javac. From there you will need to specify the rest of the path to get to the file. This will ensure that the compiler can find any other classes in the same package (or other packages) that start from this src folder.

Layne

[ January 18, 2006: Message edited by: Layne Lund ]
[ January 18, 2006: Message edited by: Layne Lund ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!