3

I'm trying to write a simple java applet program, but it seems that I'm missing the javax.servlet.* class definitions.

Using:

  1. apple snow
  2. eclipse Java EE ide

Do I need to add a specific JAR file to my project and if so, which one?

I have Macports installed in case something from the ports might be helpful.

skaffman
  • 398,947
  • 96
  • 818
  • 769
ufk
  • 30,912
  • 70
  • 235
  • 386
  • do you have `servlet.jar` on your machine? – Anthony Forloney Jan 30 '10 at 21:18
  • 1
    Why in earth do you need the Servlet API in an Applet? There must be some misconception. – BalusC Jan 31 '10 at 16:11
  • why do you think you are missing it? An expcetion? – Bozho Jan 31 '10 at 16:15
  • the servlet is for the server side programming. i'm installing tomcat now, it probably includes the missing jar. – ufk Jan 31 '10 at 19:12
  • 1
    Ah OK, you should however realize that this problem is entirely unrelated to applets and that you should in **no way** use the Servlet API in applets. Simply because they does not run inside a servlet container running at the server machine. They runs at the client machine. – BalusC Jan 31 '10 at 19:25

2 Answers2

4

This is all result of misconceptions (Applets have nothing to do with the actual problem) and ignorance about Eclipse (if offers builtin ways to seamlessly integrate and link the one and the other, the Java EE variant has already a Tomcat plugin, you just have to integrate the server and associate it with the web project).

In the future you should be more precise and detailed about the problem (and thus not telling like "...it seems that..."). Post the relevant code snippet which caused the problem. Post the actual error message (with stacktrace, if any). Post the steps to accomplish to reproduce the problem. Also see: How To Ask Questions The Smart Way.

I've answered several times before how to get started with Eclipse+Tomcat+Servlets, you may find it useful as well:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • the problem was that i was pretty lost on that subject and that's why i could not give more information or even an accurate information. thanks for providing all the relevant details for me to better understand how things work. – ufk Jan 31 '10 at 22:23
0

Thank for all of your helpful comments. I installed tomcat 6 and it contains the missing jar in order to compile the project.

Nice plug-in to load tomcat applications :

Sysdeo Eclipse Tomcat Launcher plugin - http://www.eclipsetotale.com/tomcatPlugin.html

Using Netbeans i was able to properly compile tomcat applications just by creating a new java web application. for now i'll stick to netbeans, it also has a nice gui for connecting to the server and seeing the installed applications and their status.

ufk
  • 30,912
  • 70
  • 235
  • 386