Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Package javax.servlet.http not found

Status
Not open for further replies.

darine

Programmer
Jun 23, 2000
28
0
0
US
Hi all<br>I have this servlet class in the bottom ,i set the classpath to :<br>c:\jdk1.2.2\lib\tools.jar;c:\jswdk-1.0.1\lib\servlet.jar<br>in the classpath under environment tab,then i restart my computer.<br>what i'm getting is :javax.servlet.http not found in import.<br>Please help with it and i appreciate your help.<br>import java.io.*;<br>import javax.servlet.*;<br>import javax.sevlet.http.*;<br><br>public class HelloBrowser extends HttpServlet<br>{<br>public void doGet(HttpServletRequest request,HttpServletResponse response)<br>throws IOException,ServletException<br>{<br>response.setContentType(&quot;test/html&quot;);<br>PrinterWriter out = response.getWriter();<br><br>String title = request.getHeader(&quot;User-Agent &quot;);<br>if(title == null ¦ ¦ title.equals(&quot;&quot;))<br>{<br>title=&quot;Unknown Browser &quot;;<br><br>}<br>title = &quot;Hello,&quot;+ title +&quot;!&quot;;<br>out.println(&quot;&lt;HTML&gt;&quot;);<br>out.println(&quot;&lt;HEAD&gt;&quot;);<br><br>}<br>}<br><br><br>
 
What I can say is... I know it exists, and you know it exists. But do your jar files contain them?<br><br>Jar files are zip files that have a different extension, basically... so.. the quick way to see if your jar files are up to date is to make a copy of them, change the extension to zip, unzip them and take a look for that package (or if you have a JAR viewer, that'd be a lot quicker I'm sure). My guess is it's the c:\jswdk-1.0.1\lib\servlet.jar ... 1.0.1 doesn't sound extremely up to date. what is jswdk? java-servlets-w?-development-kit? Try updating that, see what happens... <p>Liam Morley<br><a href=mailto:lmorley@wpi.edu>lmorley@wpi.edu</a><br><a href=] :: imotic :: website :: [</a><br>"light the deep, and bring silence to the world.<br>
light the world, and bring depth to the silence.
 
There is a directory in jswdk101\src that contains all the servlet classes. Under ..\src you will find javax\servlet and javax\servlet\http. If this is in your path it should work. I put the javax directory and all the sub directories in the directory where my programs reside, but you shouldn't need to do that.<br><br>Jerry
 
src is usually the directory for source files... you want class, not src. Make sure those are compiled classes... <p>Liam Morley<br><a href=mailto:lmorley@wpi.edu>lmorley@wpi.edu</a><br><a href=] :: imotic :: website :: [</a><br>"light the deep, and bring silence to the world.<br>
light the world, and bring depth to the silence.
 
Thanks alot,just i download jsdk2.1 and it compiled well,but<br>i'm trying to run it using Tomcat 3.1AND I'M&nbsp;&nbsp;geting problems ,here is what i did:<br>1- I went to server.xml and i changed the port from 8080 to 80<br>2- I put this the following line in top of startup.bat script,before (@echo off)<br>&nbsp;&nbsp;&nbsp;&quot;SET JAVA_HOME=d\jdk1.2.2 &quot;<br>3- I put the HelloBrowser.class in classes directory under<br>&nbsp;&nbsp;&nbsp;WEB_INF<br>4- I start the server by double click startup.bat from explore<br>5- I put in the browser:<A HREF=" TARGET="_new"> got error.i did not get the right result.<br>i hope you see the problem,i appreciate your help
 
it's hard to know what error you got... are you getting a connection at all? <p>Liam Morley<br><a href=mailto:lmorley@wpi.edu>lmorley@wpi.edu</a><br><a href=] :: imotic :: website :: [</a><br>"light the deep, and bring silence to the world.<br>
light the world, and bring depth to the silence.
 
i guess its with ur speelling..checkout the 3- import statement of ur prog'..!<br>Also,the classpath stuff is pretty straightf/w<br>D/load jsdk2.1<br>set ur classpath to the servlet.jar !<br>thats it .. <p>Narasimhan Sriram<br><a href=mailto:narasimhansriram@yahoo.com>narasimhansriram@yahoo.com</a><br><a href= > </a><br>sun Certified Java Programmer :)
 
what i did:<br>1-i put this code in server.xml<br>&nbsp;&nbsp;&lt;Context path=&quot;/mytest&quot; docBase=&quot;webapps/mytest&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;defaultSessionTimeOut=&quot;30&quot; isWARExpanded=&quot;true&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;isWARValidated=&quot;false&quot; isInvokerEnabled=&quot;true&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;isWorkDirPersistent=&quot;false&quot;/&gt;<br>2- i create mytest directory under jakarta-tomkat/webapps<br>3- i create WEB-INF directory under mytest.<br>4- i create web.xml file and i save it in WEB-INF directory ,web.xml has:<br>&nbsp;&nbsp;&nbsp;&lt;?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?&gt;<br><br>&lt;!DOCTYPE web-app<br>&nbsp;&nbsp;&nbsp;&nbsp;PUBLIC &quot;-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&quot;<A HREF=" TARGET="_new"> put HelloBrowser.java and HelloBrowser.class in directory i called (classes ) under WEB-INF<br>6- i restart tomcat<br>7- i point my browser to: <A HREF=" TARGET="_new"> got this message:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;server error the proxy has encountered an internal error.....<br>i do appreciate your time and your help,it is really hard for me to figureout what is the problem,but soon i run the first servlet it will be easy for me.<br>thanks alot.<br>&nbsp;&nbsp;&nbsp;&nbsp;<br><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top