LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   package javax.servlet does not exist on Fedora 10 / Tomcat 6 (https://www.linuxquestions.org/questions/linux-server-73/package-javax-servlet-does-not-exist-on-fedora-10-tomcat-6-a-695966/)

martijnburger 01-08-2009 06:11 PM

package javax.servlet does not exist on Fedora 10 / Tomcat 6
 
Hi Everyone,

I'm really imbarresed to have to ask this question because there are already al lot of threads to be found regarding the same question, however, I haven't been able to get the solutions proposed there working on my system.

My configuration is:
Fedora 10
Apache 2.2
Sun JDK 1.6
Tomcat 6

When I try to compile a simple .java I get a compiler error stating:

package javax.servlet does not exist

I've tried including /usr/share/java/tomcat6-servlet-2.5-api.jar which didn't solve the problem.

What am I doing wrong?

Mega Man X 01-08-2009 06:35 PM

Quote:

Originally Posted by martijnburger (Post 3401713)
Hi Everyone,

I'm really imbarresed to have to ask this question because there are already al lot of threads to be found regarding the same question, however, I haven't been able to get the solutions proposed there working on my system.

My configuration is:
Fedora 10
Apache 2.2
Sun JDK 1.6
Tomcat 6

When I try to compile a simple .java I get a compiler error stating:

package javax.servlet does not exist

I've tried including /usr/share/java/tomcat6-servlet-2.5-api.jar which didn't solve the problem.

What am I doing wrong?

The problem is that servlet.jar is not on your CLASSPATH. You will need to export it in order to get it to compile. Something like this should do:

Code:

export CLASSPATH=$CLASSPATH:/usr/share/java/tomcat6-servlet-2.5-api.jar
NOTE: the above may not work, I am guessing the path only

Personally, I would not touch servlets without an IDE. With an IDE, you could simply add your jars to your project, painless, letting you, the programmer, to do what you are supposed to do: program :D

Just a hint ;)

martijnburger 01-09-2009 05:57 AM

Thanks for the reply. I've tried including the servlet api in a CLASSPATH env variable, and in the parameters on the commandline (-classpath), I even tried copying the /usr/share/java/tomcat6-servlet-2.5-api.jar to my directory where I was compiling the java servlet. It all doesn't work :(

BTW: I have no CLASSPATH set at all at the moment.

BTW2: I'm running this on a old server, with no X or GNOME, let alone an IDE.

martijnburger 01-10-2009 04:44 PM

Solved it! I said it would be something imbarresing, and it is. I put a semicolon in my CLASSPATH instead of a colon. Thanks for the help anyway!

Mega Man X 01-10-2009 05:18 PM

Quote:

Originally Posted by martijnburger (Post 3403920)
Solved it! I said it would be something imbarresing, and it is. I put a semicolon in my CLASSPATH instead of a colon. Thanks for the help anyway!

Congratz mate. Thanks for replying to your own post by the way. It sure will help other people when looking after a solution for the same problem.


All times are GMT -5. The time now is 10:05 PM.