tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kwok Peng Tuck <pengt...@makmal.net>
Subject Re: faulty fix for (javax.servlet does not exist)
Date Mon, 02 Jun 2003 03:59:43 GMT
That's because it's javac -classpath.


Jonathan Michael Nowacki wrote:

>I'm compiling with root, 
>
>$ javac -cp /var/tomcat4/common/lib/servlet.jar MultiServlet.java
>javac: invalid flag: -cp
>Usage: javac <options> <source files>
>
>and if I change my classpath to:
>$ echo $CLASSPATH
>/var/tomcat4/common/lib/servlet.jar
>
>I still get the same error
>
>$ javac MultiServlet.java 
>MultiServlet.java:1: package javax.servlet does not exist
>import javax.servlet.*;
>^
>MultiServlet.java:2: package javax.servlet.http does not exist
>import javax.servlet.http.*;
>^
>
>Weird isn't it.
>
>
>
>
>On Mon, 2 Jun 2003, Jason Bainbridge wrote:
>
>  
>
>>Simplify things... Firstly that extensive CLASSPATH you have created could be 
>>causing more problems than it is solving, so try removing it.
>>
>>Then just try:
>>
>>javac -cp /var/tomcat4/common/lib/servlet.jar MultiServlet.java
>>
>>Does that work?
>>
>>If not does the user you are compiling with have rights to access 
>>/var/tomcat4/common/lib/servlet.jar ?
>>
>>Regards,
>>Jason
>>
>>
>>On Mon, 2 Jun 2003 00:00, Jonathan Michael Nowacki wrote:
>>    
>>
>>>This website http://www.sitepoint.com/article/509/3 says all I have to do
>>>is put servlet.jar in my classpath to solve my problems. Unfortunitally,
>>>it doesn't seem to work.
>>>
>>>      
>>>
>>>>>This is my error
>>>>>          
>>>>>
>>>>--------------------------------------------------------------------------
>>>>-------------------------------
>>>>
>>>>        
>>>>
>>>>>$ javac MultiServlet.java
>>>>>MultiServlet.java:1: package javax.servlet does not exist
>>>>>import javax.servlet.*;
>>>>>^
>>>>>MultiServlet.java:2: package javax.servlet.http does not exist
>>>>>import javax.servlet.http.*;
>>>>>^
>>>>>          
>>>>>
>>>>--------------------------------------------------------------------------
>>>>-----
>>>>        
>>>>
>>>THis is my path
>>>$ echo $CLASSPATH
>>>/var/tomcat4/common/lib/commons-dbcp.jar:/var/tomcat4/common/lib/naming-res
>>>ources.jar:/var/tomcat4/common/lib/jdbc2_0-stdext.jar:/var/tomcat4/
>>>common/lib/commons-collections.jar:/var/tomcat4/common/lib/naming-factory.j
>>>ar:/var/tomcat4/common/lib/jasper-runtime.jar:/var/tomcat4/common/l
>>>ib/ant.jar:/var/tomcat4/common/lib/naming-common.jar:/var/tomcat4/common/li
>>>b/jasper-compiler.jar:/var/tomcat4/common/lib/activation.jar:/var/t
>>>omcat4/common/lib/jndi.jar:/var/tomcat4/common/lib/servlet.jar:/var/tomcat4
>>>/common/lib/commons-logging-api.jar:/var/tomcat4/common/lib/jta.jar
>>>
>>>:/var/tomcat4/common/lib/commons-pool.jar:/var/tomcat4/common/lib/mailapi.j
>>>:ar:/var/tomcat4/server/lib/servlets-common.jar:/var/tomcat4/server/
>>>
>>>lib/commons-fileupload.jar:/var/tomcat4/server/lib/tomcat-http11.jar:/var/t
>>>omcat4/server/lib/servlets-cgi.renametojar:/var/tomcat4/server/lib/
>>>commons-digester.jar:/var/tomcat4/server/lib/tomcat-coyote.jar:/var/tomcat4
>>>/server/lib/mx4j.license:/var/tomcat4/server/lib/commons-beanutils.
>>>jar:/var/tomcat4/server/lib/servlets-webdav.jar:/var/tomcat4/server/lib/mx4
>>>j-jmx.jar:/var/tomcat4/server/lib/catalina.jar:/var/tomcat4/server/
>>>lib/servlets-ssi.renametojar:/var/tomcat4/server/lib/jakarta-regexp-1.2.jar
>>>:/var/tomcat4/server/lib/catalina-ant.jar:/var/tomcat4/server/lib/t
>>>omcat-jk2.jar:/var/tomcat4/server/lib/commons-logging.jar:/var/tomcat4/serv
>>>er/lib/commons-modeler.jar:/var/tomcat4/server/lib/jaas.jar:/var/to
>>>mcat4/server/lib/servlets-default.jar:/var/tomcat4/server/lib/servlets-invo
>>>ker.jar:/var/tomcat4/server/lib/servlets-manager.jar:/var/tomcat4/s
>>>erver/lib/tomcat-jk.jar:/var/tomcat4/server/lib/tomcat-util.jar:/var/tomcat
>>>4/server/lib/tomcat-warp.jar:/usr/java/j2sdk1.4.1_02/lib/dt.jar:/us
>>>r/java/j2sdk1.4.1_02/lib/j2ee.jar:/usr/java/j2sdk1.4.1_02/lib/j2eetools.jar
>>>:/usr/java/j2sdk1.4.1_02/lib/tools.jar:/usr/java/j2sdk1.4.1_02/lib/
>>>htmlconverter.jar:/usr/java/j2sdk1.4.1_02/lib/j2ee-ri-svc.jar:/usr/java/j2s
>>>dk1.4.1_02/lib/jhall.jar:/usr/java/j2sdkee1.4/lib/j2ee.jar:/usr/jav
>>>a/j2sdkee1.4/lib/j2ee-ri-svc.jar:/usr/java/j2sdkee1.4/lib/j2eetools.jar:/us
>>>r/java/j2sdkee1.4/lib/jhall.jar
>>>
>>>The actual code is
>>>CLASSPATH=/var/tomcat4/common/lib/commons-dbcp.jar:/var/tomcat4/common/lib/
>>>naming-resources.jar:/va
>>>r/tomcat4/common/lib/jdbc2_0-stdext.jar:/var/tomcat4/common/lib/commons-col
>>>lections.jar:/var/tomcat
>>>4/common/lib/naming-factory.jar:/var/tomcat4/common/lib/jasper-runtime.jar:
>>>/var/tomcat4/common/lib/
>>>ant.jar:/var/tomcat4/common/lib/naming-common.jar:/var/tomcat4/common/lib/j
>>>asper-compiler.jar:/var/
>>>tomcat4/common/lib/activation.jar:/var/tomcat4/common/lib/jndi.jar:/var/tom
>>>cat4/common/lib/servlet.
>>>jar:/var/tomcat4/common/lib/commons-logging-api.jar:/var/tomcat4/common/lib
>>>/jta.jar:/var/tomcat4/co
>>>mmon/lib/commons-pool.jar:/var/tomcat4/common/lib/mailapi.jar:/var/tomcat4/
>>>server/lib/servlets-comm
>>>on.jar:/var/tomcat4/server/lib/commons-fileupload.jar:/var/tomcat4/server/l
>>>ib/tomcat-http11.jar:/va
>>>r/tomcat4/server/lib/servlets-cgi.renametojar:/var/tomcat4/server/lib/commo
>>>ns-digester.jar:/var/tom
>>>cat4/server/lib/tomcat-coyote.jar:/var/tomcat4/server/lib/mx4j.license:/var
>>>/tomcat4/server/lib/comm
>>>ons-beanutils.jar:/var/tomcat4/server/lib/servlets-webdav.jar:/var/tomcat4/
>>>server/lib/mx4j-jmx.jar:
>>>/var/tomcat4/server/lib/catalina.jar:/var/tomcat4/server/lib/servlets-ssi.r
>>>enametojar:/var/tomcat4/
>>>server/lib/jakarta-regexp-1.2.jar:/var/tomcat4/server/lib/catalina-ant.jar:
>>>/var/tomcat4/server/lib/
>>>tomcat-jk2.jar:/var/tomcat4/server/lib/commons-logging.jar:/var/tomcat4/ser
>>>ver/lib/commons-modeler.
>>>jar:/var/tomcat4/server/lib/jaas.jar:/var/tomcat4/server/lib/servlets-defau
>>>lt.jar:/var/tomcat4/serv
>>>er/lib/servlets-invoker.jar:/var/tomcat4/server/lib/servlets-manager.jar:/v
>>>ar/tomcat4/server/lib/to
>>>mcat-jk.jar:/var/tomcat4/server/lib/tomcat-util.jar:/var/tomcat4/server/lib
>>>/tomcat-warp.jar:/usr/ja
>>>va/j2sdk1.4.1_02/lib/dt.jar:/usr/java/j2sdk1.4.1_02/lib/j2ee.jar:/usr/java/
>>>j2sdk1.4.1_02/lib/j2eeto
>>>ols.jar:/usr/java/j2sdk1.4.1_02/lib/tools.jar:/usr/java/j2sdk1.4.1_02/lib/h
>>>tmlconverter.jar:/usr/ja
>>>va/j2sdk1.4.1_02/lib/j2ee-ri-svc.jar:/usr/java/j2sdk1.4.1_02/lib/jhall.jar:
>>>/usr/java/j2sdkee1.4/lib
>>>/j2ee.jar:/usr/java/j2sdkee1.4/lib/j2ee-ri-svc.jar:/usr/java/j2sdkee1.4/lib
>>>/j2eetools.jar:/usr/java /j2sdkee1.4/lib/jhall.jar
>>>
>>>which is very long so, in short it contains:
>>>All the J2sdk 1.4 jar files
>>>All the J2sdk Enterprise edition Jar files
>>>
>>>and the following tomcat jar files
>>>/var/tomcat4/common/lib/
>>>
>>>      
>>>
>>>>>activation.jar           commons-dbcp.jar         jasper-compiler.jar
>>>>>jndi.jar     naming-common.jar     servlet.jar
>>>>>ant.jar                  commons-logging-api.jar  jasper-runtime.jar
>>>>>jta.jar      naming-factory.jar
>>>>>commons-collections.jar  commons-pool.jar         jdbc2_0-stdext.jar
>>>>>mailapi.jar  naming-resources.jar
>>>>>          
>>>>>
>>>/var/tomcat4/server/lib/
>>>
>>>      
>>>
>>>>>catalina-ant.jar        commons-logging.jar     mx4j.license
>>>>>servlets-manager.jar      tomcat-jk2.jar
>>>>>catalina.jar            commons-modeler.jar
>>>>>          
>>>>>
>>>servlets-cgi.renametojar
>>>
>>>      
>>>
>>>>>servlets-ssi.renametojar  tomcat-jk.jar
>>>>>commons-beanutils.jar   jaas.jar                servlets-common.jar
>>>>>servlets-webdav.jar       tomcat-util.jar
>>>>>commons-digester.jar    jakarta-regexp-1.2.jar  servlets-default.jar
>>>>>tomcat-coyote.jar         tomcat-warp.jar
>>>>>commons-fileupload.jar  mx4j-jmx.jar            servlets-invoker.jar
>>>>>          
>>>>>
>>>After doing all this work, The compilation errors still occure, despite
>>>what the documentation and help files tell me.
>>>
>>>Correct me if I'm wrong, but I thought *.jar was valid, it works on my
>>>other files.
>>>
>>>On Sun, 1 Jun 2003, Jacob Kjome wrote:
>>>      
>>>
>>>>You have an invalid classpath.  Note that you must add each and every
>>>>.jar file to the classpath.  It is invalid to specify *.jar.  The only
>>>>way that would work is by using a batch file and looping through all jar
>>>>files in a directly and then adding each to the classpath for each
>>>>iteration.  Fix that and your compilation will start working properly. 
>>>>I'd suggest learning about Ant to do you builds as well.
>>>>
>>>>Jake
>>>>
>>>>At 01:56 AM 6/1/2003 -0500, you wrote:
>>>>        
>>>>
>>>>>This website http://www.sitepoint.com/article/509/3 says all I have to
>>>>>do is put servlet.jar in my classpath to solve my problems. 
>>>>>Unfortunitally, it doesn't seem to work.
>>>>>
>>>>>
>>>>>This is my path
>>>>>------------------
>>>>>$ echo $CLASSPATH
>>>>>/usr/java/j2sdkee1.4/lib/*.jar:/usr/java/j2sdk1.4.1_02/lib/*.jar:/var/to
>>>>>mcat4/server/lib/*.jar:/var/tomcat4/common/lib/*.jar
>>>>>
>>>>>The classpath is set in the .bashrc, but that should effect the javac
>>>>>command right?!?  I've also done the classpath without the *.jar by
>>>>>explicitly naming each of the jar files.... talk about a pain.
>>>>>
>>>>>
>>>>>This is my error
>>>>>------------------------------------------------------------------------
>>>>>--------------------------------- $ javac MultiServlet.java
>>>>>MultiServlet.java:1: package javax.servlet does not exist
>>>>>import javax.servlet.*;
>>>>>^
>>>>>MultiServlet.java:2: package javax.servlet.http does not exist
>>>>>import javax.servlet.http.*;
>>>>>^
>>>>>------------------------------------------------------------------------
>>>>>-------
>>>>>
>>>>>
>>>>>
>>>>>these are installed:
>>>>>---------------------------------
>>>>>tomcat4-webapps-4.1.24-full.2jpp
>>>>>tomcat4-4.1.24-full.2jpp
>>>>>tomcat4-admin-webapps-4.1.24-full.2jpp
>>>>>j2re1.4.1_02
>>>>>j2sdk1.4.1_02
>>>>>j2sdkee1.4
>>>>>
>>>>>
>>>>>The tomcat lib jar files
>>>>>--------------------------------------
>>>>>classes $ ls /var/tomcat4/common/lib/
>>>>>activation.jar           commons-dbcp.jar         jasper-compiler.jar
>>>>>jndi.jar     naming-common.jar     servlet.jar
>>>>>ant.jar                  commons-logging-api.jar  jasper-runtime.jar
>>>>>jta.jar      naming-factory.jar
>>>>>commons-collections.jar  commons-pool.jar         jdbc2_0-stdext.jar
>>>>>mailapi.jar  naming-resources.jar
>>>>>
>>>>>classes $ ls /var/tomcat4/server/lib/
>>>>>catalina-ant.jar        commons-logging.jar     mx4j.license
>>>>>servlets-manager.jar      tomcat-jk2.jar
>>>>>catalina.jar            commons-modeler.jar     servlets-cgi.renametojar
>>>>>servlets-ssi.renametojar  tomcat-jk.jar
>>>>>commons-beanutils.jar   jaas.jar                servlets-common.jar
>>>>>servlets-webdav.jar       tomcat-util.jar
>>>>>commons-digester.jar    jakarta-regexp-1.2.jar  servlets-default.jar
>>>>>tomcat-coyote.jar         tomcat-warp.jar
>>>>>commons-fileupload.jar  mx4j-jmx.jar            servlets-invoker.jar
>>>>>tomcat-http11.jar
>>>>>
>>>>>
>>>>>---------------------------------------------------------------------
>>>>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>>>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>>>>          
>>>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>>      
>>>
>>-- 
>>Jason Bainbridge
>>KDE Web Team - http://kde.org 
>>webmaster@kde.org 
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message