Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 12-07-2012, 07:07 PM   #1
Registered: Nov 2010
Distribution: VectorLinux
Posts: 87

Rep: Reputation: 0
javax.servlet does not exist


I'm trying to set up a tomcat server to develop java applications. I install CentOS 6.3 and included java and tomcat packages during installation. When I tried to compile a simple servlet, I got javax.servlet does not exist. What should I do?

Where should I place the .class servlet? The book I'm reading about servlets is saying one thing, the I find yet other things online. I don't want to mess the settings up. I found and online poster suggesting to create a folder under /usr/share/tomcat6/webapp and move all the .class there and it will work without any further settings. Is this true?

Thank you very much,
Old 12-08-2012, 08:30 PM   #2
Registered: Nov 2010
Distribution: VectorLinux
Posts: 87

Original Poster
Rep: Reputation: 0
I'm getting closer to getting it to work but need help please. I need to set the JAVA_HOME path. Here is what I tried:

vi ~/.bash_profile

I didn't find an entry for JAVA_HOME. So I tried echo $ JAVA_HOME , I got -Home

A website suggested I add export JAVA_HOME=/usr/java/jdk1.5.0_07/bin/java to the .bash_profile file. I couldn't find the /usr/java directory but I found the following:

usr/share/java 1.3.1
usr/share/java 1.4.0
usr/share/java 1.4.1
usr/share/java 1.4.2
usr/share/java 1.5.0
usr/share/java 1.6.0
usr/share/java 1.7.0

When I type java -version at command line, it got java version "1.6.0_24"

Should I add export JAVA_HOME=/usr/share/java 1.6.0 to .bash_profile?

The .bash_profile file has the following 2 lines:

export PATH

When I typed echo $PATH , the output was


how do I add /usr/share/tomcat6/lib to the path to get java to compile my servlet?
Old 12-10-2012, 04:50 AM   #3
LQ Newbie
Registered: Nov 2012
Posts: 3

Rep: Reputation: 0

Using the HttpSession interface of the The Java Servlet Specification is one of the possible ways of maintaining the sessions more effectively and far more easily. All the J2EE compliant containers have the implementation of the underlying classes and the user simply need to call the APIs to use the services.

All your query about Java Development are welcome.

Old 12-10-2012, 12:02 PM   #4
Registered: Nov 2010
Distribution: VectorLinux
Posts: 87

Original Poster
Rep: Reputation: 0
I edited the export line in ~/.bash_profile from

export PATH


export PATH

restarted the computer but still I get the same error " javax.servlet does not exist"


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
package javax.mail does not exist for centos 6.2 newbie14 Linux - Software 9 05-21-2012 01:04 AM
package javax.servlet does not exist on Fedora 10 / Tomcat 6 martijnburger Linux - Server 4 01-10-2009 05:18 PM
Tomcat: package javax.servlet does not exist xpucto Linux - Software 0 03-21-2006 06:45 AM
what is import javax.swing.*; Dutchman Programming 4 06-16-2005 10:12 AM
getting javax.swing.* to appear student04 Programming 8 10-05-2004 10:06 AM > Forums > Non-*NIX Forums > Programming

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

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration