importing javax.servlet.* and javax.servlet.http using Eclipse in Ubuntu
Joined: May 30, 2012
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.
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.
Joined: May 30, 2012
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.* .