aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes importing javax.servlet.* and javax.servlet.http using Eclipse in Ubuntu Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "importing javax.servlet.* and javax.servlet.http using Eclipse in Ubuntu" Watch "importing javax.servlet.* and javax.servlet.http using Eclipse in Ubuntu" New topic
Author

importing javax.servlet.* and javax.servlet.http using Eclipse in Ubuntu

pakske fritten
Greenhorn

Joined: May 30, 2012
Posts: 5
Hi
Im a beginner who just finished head first Java. I need to install the servlets jar but don't know exactly how. I am using eclipse on ubuntu and have tomcat installed. Currently eclipse does not know how to import javax.servlet.*


1)where do I find servet.jar
2)do I manually download it and then copy it in some folder? Or do I import it in the IDE eclipse?
3) what does tomcat have to do with this; I read everywhere I need . I installed tomcat 6.


Thanks.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61418
    
  67

pakske fritten wrote:
1)where do I find servet.jar

In Tomcat's lib folder. And it's not "servet.jar" (please proofread your posts), it's servlet-api.jar.

2)do I manually download it and then copy it in some folder? Or do I import it in the IDE eclipse?

If you've downloaded Tomcat, you already have it. You need to configure eclipse to find it. (Don't ask me how; I don't use eclipse.)

3) what does tomcat have to do with this; I read everywhere I need . I installed tomcat 6.

How do you expect to run your servlets without a servlet engine?

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

First, make sure that downloaded the Eclipse package named "Eclipse IDE for Java EE Developers".

Second, in Eclipse you need to create two things. The first is a Server, and the other is a Dynamic Wen App project. This tutorial might help with the details:
http://www.coreservlets.com/Apache-Tomcat-Tutorial/tomcat-7-with-eclipse.html


JBoss In Action
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16141
    
  21

Peter Johnson wrote:First, make sure that downloaded the Eclipse package named "Eclipse IDE for Java EE Developers".

Second, in Eclipse you need to create two things. The first is a Server, and the other is a Dynamic Wen App project. This tutorial might help with the details:
http://www.coreservlets.com/Apache-Tomcat-Tutorial/tomcat-7-with-eclipse.html


Only if you enjoy gouging out your own eyeballs. There are better ways. I recommend the sysdeo Tomcat plugin, myself.

Regardless of whether you use the unspeakably vile built-in WTP plugin or some other plugin such as sysdeo, however, you must have a copy of Tomcat installed on your Ubuntu machine somewhere. Exactly where isn't important as long as you can run Tomcat.

The easiest way to make the servlet APIs visible to the compiler for an Eclipse project is to a library of jars so that the servlet and jsp API jars are symbolically (and portably) referenceable by all projects in the workspace. You can do this by:

1. selecting a Java project and opening its properties dialog to the build path page.
2. On the Java Build Path page, select the Libraries tab.
3. Click the Add Library button
4. Select User Library/Next.
5. Click the "User Libraries..." button.
6. Click "New" to create a new User Library. Give it a name (I use "TOMCAT", but "J2EE" is a good choice, too).
7. Click the "Add Jars" button to add jars to this library definition. Add the jsp-api.jar and servlet-api.jars from your installed Tomcat's lib directory.

Done! You can now save this definition, add it to your project by checking the checkbox on Add Library/User Library/Next/User Libraries...", and do likewise for any other webapp projects you have.

Customer surveys are for companies who didn't pay proper attention to begin with.
pakske fritten
Greenhorn

Joined: May 30, 2012
Posts: 5
Perfect response.
I found the servlet-api.jar and jsp-api.jar files in /usr/share/tomcat6/lib and added it and now ECLIPSE recognizes the javax.servlet.* .
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: importing javax.servlet.* and javax.servlet.http using Eclipse in Ubuntu