LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   javax.servlet does not exist (https://www.linuxquestions.org/questions/programming-9/javax-servlet-does-not-exist-4175440509/)

Whatif 12-07-2012 07:07 PM

javax.servlet does not exist
 
Hello,

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,
Mike

Whatif 12-08-2012 08:30 PM

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
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:

PATH=$PATH:$HOME/bin
export PATH

When I typed echo $PATH , the output was

/usr/lib/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/mike/bin

how do I add /usr/share/tomcat6/lib to the path to get java to compile my servlet?

aegisisc 12-10-2012 04:50 AM

Re:-
 
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.

Thanks.

Whatif 12-10-2012 12:02 PM

I edited the export line in ~/.bash_profile from

PATH=$PATH:$HOME/bin
export PATH

to

PATH=$PATH:/usr/share/tomcat6/lib/tomcat6-servlet-2.5-api-6.0.24.jar:/usr/share/tomcat6/lib/tomcat6-jsp-2.1-api-6.0.24.jar:/usr/share/tomcat6/lib/tomcat6-el-2.1-api-6.0.24.jar:$HOME/bin
export PATH

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


All times are GMT -5. The time now is 08:30 PM.