• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

package javax.servlet does not exist

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, this is a pretty simple issue, i've installed tomcat, j2sdk on aonther pc, but cant compile my .java file because the compiler does not find the "javax" packages (no problem with java.sql, java.io, etc ).. i think i need to mover or copy a jar file but can't remember .....

thanks
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In your editor, that is compiling, or whatever you use to compile, you need to set the jar file into the classpath.

Mark
 
vannia hdz
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Mark Spritzler:
In your editor, that is compiling, or whatever you use to compile, you need to set the jar file into the classpath.

Mark



classpath is : CLASSPATH=C:\jakarta-tomcat-5.0.19\common\lib
that's where servlet-api.jar is..
That IS the right file huh?
 
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It should be:

CLASSPATH=C:\jakarta-tomcat-5.0.19\common\lib\servlet-api.jar;

I have no idea if this is the correct .jar since I don't work on tomcat but the .jar with the servlet api, whether it be this one or the j2ee.jar, needs to be included in your classpath.
 
vannia hdz
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by William Duncan:
It should be:

CLASSPATH=C:\jakarta-tomcat-5.0.19\common\lib\servlet-api.jar;

I have no idea if this is the correct .jar since I don't work on tomcat but the .jar with the servlet api, whether it be this one or the j2ee.jar, needs to be included in your classpath.



Thanks!!
BTW, have a Good Weekend
 
Saloon Keeper
Posts: 28757
211
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just as a reminder, you can set a CLASSPATH to point to directories, but the only classes that will be found are the "loose" (.class) files. JARs have to be mentioned explicitly by name.

Systems like Tomcat make that not obvious, because their startup scripts often have code in them that scoop up all the jars in a directory and add each on to the CLASSPATH. The java compiler ("javac") and "java" programs don't.

In Tomcat 4, the servlet defs were in %TOMCAT_HOME%\common\lib\servlet.jar. Where you set TOMCAT_HOME is your privilege.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic