• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

compile errors  RSS feed

 
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>
 
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 ]
 
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
 
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.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!