• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

compile errors

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic