Get your CodeRanch badge!*
The moose likes Servlets and the fly likes New to servlet ......need help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "New to servlet ......need help" Watch "New to servlet ......need help" New topic
Author

New to servlet ......need help

Ramesh Subramanian
Greenhorn

Joined: Oct 03, 2000
Posts: 13
Hi all,
I'm new to servlet.
I'm having jdk1.3,JRun on win'98.
with that JRun i can able to Simple JSP pgms what they have given on the demo.
But i couldn't run the Servlet pgms.
where can i able to download the JSDK alone. i dont want to download anyother servers..
Can anyone pl tell me from which site can i download the JSDK2.x.
alone.
Thanks in Advance.

P SOLAIAPPAN
Ranch Hand

Joined: Oct 20, 2000
Posts: 68
Hi Subramainian,
I don't understand why your are not able to run your servlet program in "JRun3.0". You have not mentioned what is the problem you have faced, instead you are trying to down load Jsdk2.X?? What you will do if you face the same problem in Jsdk also.
The procedure for running Servlets (as per JRun documents)
How do I Get Started with Servlets?
Many developers find it helpful to code and run a simple example before reading the documentation. The following procedure tells you how to create a simple servlet:
1. Ensure that JDK 1.1.8 (or higher) has been installed.
2. Ensure that the system path includes the JDK's bin directory.

3. Enter the following code and save it as MyFirstServlet.java in <jruninstalldirectory>/servers/default/default-app/WEB-INF/classes (replace <jruninstalldirectory> with the path to the directory in which you installed JRun for e.g c:\JRun\):
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class MyFirstServlet extends HttpServlet {
public void doGet(HttpServletRequest req,
HttpServletResponse res) throws IOException, ServletException {
// Specify content type.
res.setContentType("text/html");
// Access the output stream.
PrintWriter out = res.getWriter();
// Return HTML.
out.println("<html><head><title>My First Servlet");
out.println("</title></head><body>");
out.println("<h1>My First Servlet</h1>");
out.println("<p>This text came from a servlet.</p>");
out.println("</body></html>");
}
}
Compile your code by entering the following commands:
cd <jruninstalldirectory>\servers\default\default-app\WEB-INF\classes
javac -classpath ".;<jruninstalldirectory>\lib\ext\servlet.jar" MyFirstServlet.java
Ensure that the JRun default server is running.
Open a browser and specify the following URL: http://<server>:8100/servlet/MyFirstServlet
The previous URL assumes that the JRun default server is running on port 8100. If you have run the Connector Wizard successfully, you can also use http://<server>/servlet/MyFirstServlet
Note: The default server will listen at port ":8100" you can change it in DefaultServer set up.
Try the above example.
solaiappan
Ramesh Subramanian
Greenhorn

Joined: Oct 03, 2000
Posts: 13
Hi Soliappan,
Thanks.Yah i already went thro that.I tried for so many times.All the time it is saying "can't resolve the symbol."
and it's pointing errors in all servelt HTTPServlet classes.
It's a basic ques.At what circumstances we need JSDK?
Because for JRUN, they 're looking for only JDK1.8 or higher isn't it?
Travis Gibson
Ranch Hand

Joined: Oct 17, 2000
Posts: 100
I am having the same problem. I get can't resolve HTTPServlet class error messages too. I am however able to use APACHE/TOMCAT to serve up sample Servlets but when I try to compile my servlet it bombs..Help!
Regards,
Travis M. Gibson
Originally posted by Ramesh Subramanian:
Hi Soliappan,
Thanks.Yah i already went thro that.I tried for so many times.All the time it is saying "can't resolve the symbol."
and it's pointing errors in all servelt HTTPServlet classes.
It's a basic ques.At what circumstances we need JSDK?
Because for JRUN, they 're looking for only JDK1.8 or higher isn't it?


Regards,<BR>Travis M. Gibson, SCJP<BR>Java Developer<BR>www.travismgibson.com<BR>travis@travismgibson.com
P SOLAIAPPAN
Ranch Hand

Joined: Oct 20, 2000
Posts: 68
Hi,
When JRun is there is no need for JSDK. JSDK is nothing but a small servlet engine to test your servlets before deployment. Also it contains "servlet.jar" to compile your servlets files.
But JSDK canot run JSP and it has almost become outdated.
JRun3.0 can be used to run both servlets and JSP , it contains "servlet.jar"
"when I try to compile my servlet it bombs..Help!"
I think there may be problem in setting up your class path for "servlet.jar"
In autoexec.bat include the above file with full classpath sothat you JDK will not have problem in searching "servlet.jar"
solaiappan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: New to servlet ......need help
 
Similar Threads
What containers
Executing Servlets
converting from jrun 2.3 to jrun 3.1
JSP is not Running under JRun --Pl Help Me
Web server ?