aspose file tools*
The moose likes Servlets and the fly likes Compiling the servlet 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 » Java » Servlets
Bookmark "Compiling the servlet" Watch "Compiling the servlet" New topic
Author

Compiling the servlet

Neem Red
Greenhorn

Joined: Jan 22, 2001
Posts: 15
Iam using JRun 3.0 Developer's Edition for Windows2000 and when i try to compile the servlet getting an error as
package javax.servlet does not exist
Here is my code
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloWeb extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<HTML>");
out.println("<HEAD>");
out.println("<TITLE>");
out.println("Hello Web");
out.println("</TITLE>");
out.println("</HEAD>");
out.println("<BODY>");
out.println("Hello Web!");
out.println("</BODY>");
out.println("</HTML>");
out.close();
}
public void doPost (HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
doGet(request, response);
}
}
I try to compile the servlet under
E:\<JRun directory>\servers\default\default-app\WEB-INF\classes \HelloWeb.java
Any followup???
Michael Hildner
Ranch Hand

Joined: Oct 13, 2000
Posts: 297
Make sure that j2ee.jar is in your classpath.
Neem Red
Greenhorn

Joined: Jan 22, 2001
Posts: 15
I did not find any j2ee.jar under jrun, how should i go on with it.
Neem Red
Greenhorn

Joined: Jan 22, 2001
Posts: 15
And also when i try to start the JRun Default Server getting a prompt as JRun exited abnormally.
Please check the JRun event log file.
Where is the JRun event log file placed under JRun.
Any help would be very much appreciated.
Michael Hildner
Ranch Hand

Joined: Oct 13, 2000
Posts: 297
Sorry, I've never used JRun.
But if you're getting package javax.servlet package does not exist, you need to include j2ee.jar in your CLASSPATH.
I have no idea if this ships with JRun, but can be downloaded from sun.
Padmaja Kalimireddy
Greenhorn

Joined: Mar 22, 2001
Posts: 3
Hi Neem Red,
You have to add
servlet.jar to your class path. Then it will works fine(According to my knowledge). You can find servlet jar in JRun directory/lib/ext. Try it and send me the result.
Padmaja Kalimireddy.
Neem Red
Greenhorn

Joined: Jan 22, 2001
Posts: 15
Hey Padmaja ,
Iam able to compile the servlet but when i try to start the JRun Default Server getting a prompt as JRun exited abnormally.
Please check the JRun event log file.
Where is the JRun event log file placed under JRun.
And also how do i go on looking a servlet in the browser.
Any help Padmaja?
Neem Red
Greenhorn

Joined: Jan 22, 2001
Posts: 15
Hey thanks alot padmaja now iam able to compile the servlets and
also able to open the servlet in the browser.
I have to specify the following URL http://localhost:8100/servlet/MyFirstServlet
But one thing is when i try to open the
JRun Default Server under JRun getting the same prompt as
JRun exited abnormally.
Please check the JRun event log file.
Look at this url: http://localhost:8000/quickStart/howdoi/servletStart.jsp it asks us to Ensure that the JRun default server is running.
before opening a http://localhost:8100/servlet/MyFirstServlet in the browser.
Any help???
Padmaja Kalimireddy
Greenhorn

Joined: Mar 22, 2001
Posts: 3
Hi Neem Red,
Good to know that you are able to compile. I think if you can see the servlet in browser it means it is working. Am I correct? I am not sure about the abmormally exit of jrun. When I got similar error I reinstalled Jrun and somehow the problem has gone. I don't think that is the right solution.
Let me know if you find anything.

Brian Nice
Ranch Hand

Joined: Nov 02, 2000
Posts: 195
Usually when we have gotten the JRun has exited abnormally message it means that somewhere there is another instance of JRun running on the same port. So if you installed JRun as a service that starts up automatically on port 8100, then you try and manually start JRun again on the same port, you will get this message.
If it doesn't look like there are are any other instances of JRun running, make sure and check in your task manager and see if there are any instances running that just didn't get shut down properly by the OS.
HTH
BRian
mike nu
Ranch Hand

Joined: Mar 11, 2001
Posts: 63
Hi there,
When I compile servlet, I got the similar error. I already include the jsdk.jar in classpath. What's the problem could be?
Thanks,
Mike
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Compiling the servlet