File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Royally confused on installation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Royally confused on installation" Watch "Royally confused on installation" New topic
Author

Royally confused on installation

Bob Ruth
Ranch Hand

Joined: Jun 04, 2007
Posts: 320
I got a book on Servlets and JSP. I want to follow the examples in the book and plow my way through them.

I go to Sun and get the latest J2EE w/out jdk that there is, download it, run the install and, voila, I go a box telling me, "Success" ! I now assume that everything I need to code the examples for myself is ready to go.

Then, I code an example but, when I attempt to import javax.servlet.* Netbeans can't find the package javax.servlet. It says it doesn't exit.

I Google around looking for ideas. They tell me to search for a servlet.jar and get it set into my classpath. I have searched my entire system and do not find a servlet.jar.

Many references I see tell me to bring the server up. I am stuck on the thought, "why should the server have to be running to just compile?"???
In the end I plan on putting Tomcat on my Linux box so I wont even be running a server on my Windows system.

But, in the meantime, I can't compile anything anyway....because I can't find the servlet related classes.

Is there someplace that this whole thing is documented so that I can read what I need to do and do it? Again, I assumed that when the Sun script said that installation was a success, the system was ready to go but it obviously was not.

Help???


------------------------
Bob
SCJP - 86% - June 11, 2009
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61768
    
  67

Originally posted by Bob Ruth:
Then, I code an example but, when I attempt to import javax.servlet.* Netbeans can't find the package javax.servlet. It says it doesn't exit.
Yes, you need to find the jar file containing the servlet classes and add it to your compilation classpath. At runtime, the container takes care of that for you, but for compilation you need to make sure your IDE knows to include it.

They tell me to search for a servlet.jar and get it set into my classpath. I have searched my entire system and do not find a servlet.jar.
Different containers will call the jar file something different. You need to find out what you container calls it.

Many references I see tell me to bring the server up. I am stuck on the thought, "why should the server have to be running to just compile?"???
You don't.

In the end I plan on putting Tomcat on my Linux box so I wont even be running a server on my Windows system.
Depending upon which version of Tomcat, the servlet-api.jar file will be in slightly different locations. Regardless, the jar file needs to be in the compilation classpath on the system where you will compile regardless of where the server will run.

But, in the meantime, I can't compile anything anyway....because I can't find the servlet related classes.
If you are eventually going to be using Tomcat, why aren;t you using it now? Why the Sun stuff rather than Tomcat?

Is there someplace that this whole thing is documented so that I can read what I need to do and do it? Again, I assumed that when the Sun script said that installation was a success, the system was ready to go but it obviously was not.
Sure it is. You just don;t know how to find the jar file for compilation. That's not Sun's fault.

Regardless, I'd just dump all the Sun stuff and grab Tomcat.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

Originally posted by Bob Ruth:
Netbeans can't find the package javax.servlet.


I recommend uninstalling it all, download the Netbeans with JDK bundle. It includes Tomcat. It includes sample programs that compile and work, jsp and servlets.

You may learn more fighting your way though it, but I'd do it the easy way
Bob Ruth
Ranch Hand

Joined: Jun 04, 2007
Posts: 320
*grin* thanks Pat, I do appreciate the comment. I have learned more by beating my head into things over the years. Why change now??? *grin*

Bear, thank you very much for your insight. Actually I think you have plugged a gap in my knowledge. The reason I pulled the Sun package down.... I didn't realize the tightness (in distribution packaging) of the development classes and the container itself. I wasn't even aware that a container came with the Sun distribution. I assumed that it would only install the classes/packages needed to compile and it would be up to me to go out and get a container/server. Your answer clarified that point for me. If I understand you right, when you pull down a container package, the development environment comes along with it and you need, essentially, to patch the right pieces into your classpath and you are on your way. If that sounds right, then I should be on my way pretty quickly.

What I had in mind originally was just doing some prototype coding of servlets on my Windows laptop and then deploying them to my Fedora box using Tomcat there for the server. Since originally I didn't know of the way these things were delivered, I just figured the two were separate.

In any regard, thank you both for your input. I think this will get me on the right track.

Bob
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61768
    
  67

Originally posted by Bob Ruth:
If I understand you right, when you pull down a container package, the development environment comes along with it and you need, essentially, to patch the right pieces into your classpath and you are on your way. If that sounds right, then I should be on my way pretty quickly.

Almost. Each vendor provides its own implementation of the Specification and interfaces as published by Sun.

The implementation of the Servlet classes that you get with Tomcat will not be the same ones you get with Resin, or WebSphere, or WebLogic...

But they will all (or should) adhere to the Specifications.
Bob Ruth
Ranch Hand

Joined: Jun 04, 2007
Posts: 320
I can understand that. Thank you very much again.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Royally confused on installation