• Post Reply Bookmark Topic Watch Topic
  • New Topic

compile errors  RSS feed

 
sherrie blaylock
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it cant find these javax.servlet etc from the following
i cant find a file named javax.servlet.*
or javax.servlet.http.*
or java.io.*


C:\project1\src>javac -classpath tomcat/common/lib/servlet-api.jar -d classes Ch
Servlet.java
error: cannot read: ChServlet.java
1 error

C:\project1\src>javac -classpath tomcat/common/lib/servlet-api.jar -d classes Ch
1Servlet.java
Ch1Servlet.java:1: package javax.servlet does not exist
import javax.servlet.*;
^
Ch1Servlet.java:2: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
Ch1Servlet.java:5: cannot resolve symbol
symbol : class HttpServlet
location: class Ch1Servlet
public class Ch1Servlet extends HttpServlet {
^
Ch1Servlet.java:7: cannot resolve symbol
symbol : class HttpServletRequest
location: class Ch1Servlet
public void doGet(HttpServletRequest request,
^
Ch1Servlet.java:8: cannot resolve symbol
symbol : class HttpServletResponse
location: class Ch1Servlet
HttpServletResponse response)
^
5 errors

C:\project1\src>
 
Anton Golovin
Ranch Hand
Posts: 531
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try

C:\project1\src>javac -classpath tomcat/common/lib -d classes Ch1Servlet.java

Maybe I am wrong, but the jar file should be in the classpath, which is the one above; it probably should not be included in the classpath itself.

I could be wrong, but it's worth a try.
[ November 17, 2004: Message edited by: Anton Golovin ]
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

-classpath tomcat/common/lib

Seems you cannot just specify the directory that contains the required JAR files, but also with the name of JAR file.

Nick
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
C:\project1\src>javac -classpath tomcat/common/lib/servlet-api.jar -d classes Ch
1Servlet.java
Ch1Servlet.java:1: package javax.servlet does not exist
import javax.servlet.*;
^
Ch1Servlet.java:2: package javax.servlet.http does not exist
import javax.servlet.http.*;
^


Set your classpath follow me



and compile code




ps. please make sure servlet-api.jar exist in specified directory.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!