This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Trouble locating clases

 
Michael Reynolds
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two problems. OK I have a lot of problems but only two are of concern now. I have read and re-read "Headfirst Java" (Excellent refresher BTW). I have loaded and run (verified) Tomcat 5.5 and I can even compile simple (non-import) JAVA code but
1. I can not import anything (java.io, javax.servlet...)
2. I can not for the life of me find instructions for setting up Tomcat to work with JSPs and Servlets. It can not locate (as stated above), the javax.servlet classes. What have I missed??? I think (or thought) I had the CLASSPATH and the PATH environments set (XP BTW) but still no luck locating any of the JAVA classes. Please direct me.
 
Monica Moncho
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,

I don't know if this will help you because I am coming back to this myself, but I have notes here to copy the servet.jar from tomcat\common\lib to the jre\lib\ext of wherever your jsdk is.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the Tomcat forum for expert help...
 
Michael Reynolds
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, I found the problem with the basic "java...." includes. A typo on my part!. I still can not locate any of the servlet classes though even though the API JARS exist. Where should I place these APIs and what should I add to the environment variables to allow me to import the servlet class and its derivitives?

PS: will the correction then allow me to compile and run servlets and JSP?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65105
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Monica Moncho:

I don't know if this will help you because I am coming back to this myself, but I have notes here to copy the servet.jar from tomcat\common\lib to the jre\lib\ext of wherever your jsdk is.


No, no, no! Never copy things into the Java distribution. leave the jar where it is and set you compile-time classpath to include it.
[ February 12, 2006: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65105
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Be sure that the servlet-api.jar file is in your classpath.

If you don't know how to set up the classpath, that's a subject for the beginner Java forum.
 
Michael Reynolds
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all for the information. I am only a "newbie" when it comes to JAVA. I will check the classpath and thanks again for the help. One more question though: Why is it so difficult to obtain information regarding JAVA and its tools. Tomcat information is scattered all over the place and never quite seems to answer the question. IBM and SUN information is far more voluminous yet it too fails to answer any question with a straight forward "how to". I have trouble even navigating their sites.. oh well...

Sorry. Just frustrated :-(
 
Michael Reynolds
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, I have the classpath correct (i believe). I included "tomcat5_5/common/lib" which is where the "servlet-api" JAR resides and it still can not locate any "javax.servlet.* or "javax.servlet.http.*" classes. I know that I am missing something but can not for the life of me hit on it. Any thoughts?
 
Michael Reynolds
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, my "/" are actually facing the correct way. I jump back and forth between Linux and Windows and commonly make that mistake but I just checked again to be certain (phew).

Thanks again for all of the advice. It is much appreciated.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65105
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Michael Reynolds:
OK, I have the classpath correct (i believe). I included "tomcat5_5/common/lib" which is where the "servlet-api" JAR resides ...


Unlike class files, when you add a jar file to the claspath, you add the jar file itself, not the folder in which it resides.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic