Hi All, I'm trying to learn Servlets. I tried to follow the following link tutorial http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/ If you click on the left side menu "Setup" in the tuorial site Step1. Obtain and Instal Servlet and JSP Development kits I installed JSWDK2.1. Set the classpath in my Windows 2000.Went to the correct directory and typed startserver. Then I got the message that cannot locate tools.lib. But I have already set the classpath. I opened IE and typed http://127.0.0.1:8080 the default page comes up. So the server is running correct, right ? I'm able to run the examples given in the sun site. Step 2. Install a Servlet-Capable Web Server Should I install Tomcat along with JSDK for development ? Because the site itself says we can use Apache, JSWDK, Allaire JRun as Webserver. If I'm using JSWDK should I write the JavaServlet code on notepad and run it. I cannot find a good place where they say how u compile and run servlet in JSWDk. Please some one advice. Thank you. Kumar
A few suggestions: 1) The current version of the servlet spec is 2.4, but 2.3 is by far the current standard (2.4 is VERY new and not totally supported). I am guessing that if you have JSDK 2.1 and type startserver to get a 'server' running, it is 2.1. Many new features have been added. I suggest going here for the latest. Getting j2ee.jar (1.3) will not only give you the latest servlet stuff but many other useful APIs. Putting j2ee.jar in your compile path will let you write code against the servlet API. j2ee.jar or servlet.jar are not needed at deploy time since the server is aware of them. 2) For a very good webserver that is easy to install and get started on, I suggest Tomcat. The most current version of 4.x.x supports servlet spec 2.3 with version 5.x.x supporting 2.4. You can get an .exe installer that will get the server up and running for you. 3) Do a bit of research, but once you understand the web.xml and .war layouts/standards, you can easily plug the latest version of your apps into Tomcat or just develop from the Tomcat directories.
Hi Kenneth, Tanks for the immediate response. I have figured out how the JSWDK2.1 works. Now another probem . I have set the classpath to the jspengine.jar and servlet.jar. I have written the Helloworld and tried to compile. Unfotunately the compiler is not able to locate the javax.Http.* and other import files !!! H>E>L>P
PALANI, You should not need to do this. Tomcat should handle this for you but you will need to make sure that you have the JAVA_HOME variable set. Then you just put your app in the server structure and go. I would also suggest going to the Macromedia site on download a developer's version of JRun 4.0 (used to be allaire). This will come a all the documentation you need to get going on JRun which will be a bit more user friendly than Tomcat. Then you can go back to Tomcat once you have a better understanding of things.
No more rhymes! I mean it!<br /> <br />Does anybody want a peanut?
Put j2ee.jar in your compile classpath. All J2EE classes (javax.servlet.* and so on) are in this jar. Do not distribute this jar with your app as the container (Tomcat, Weblogic, etc...) will have their implementations.