Results 1 to 5 of 5
Thread: all in one java SDK
- 01-03-2011, 12:35 PM #1
Senior Member
- Join Date
- Feb 2009
- Posts
- 117
- Rep Power
- 0
all in one java SDK
hi,
just want to know if there is an all in one package jdk? like a package which has also has the servlet-api?
I am asking this because I have been trying to make tomcat and java work together but everytime I run java files with contents in which the servlet-api is necessary, it simply won't work. already did the classpath still no go. by the way I am using tomcat 7, already tried version 6 of tomcat and still no go.
I am kind of stuck here and I can't compile java files with servlet api components so maybe is there a package from oracle which includes everything like the web classes and also the simple classes from java 6? so I don't have to setup the classpath and other stuff.
thanks for reading, any suggestions would be very much appreciated :D
- 01-03-2011, 12:58 PM #2
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
It might help to define "won't work".
- 01-03-2011, 01:06 PM #3
Senior Member
- Join Date
- Feb 2009
- Posts
- 117
- Rep Power
- 0
oh im sorry.
this is the class I have been trying to compile
then I try to use javac but it gives me this kind replyimport java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloWorld extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out = response.getWriter();
out.println("Hello World");
}
}
and if I am right the classpath is directly pointing to the servlet-api.jarHelloWorld.java:2: package javax.servlet does not exist
import javax.servlet.*;
^
HelloWorld.java:3: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
HelloWorld.java:4: cannot find symbol
symbol: class HttpServlet
public class HelloWorld extends HttpServlet {
^
HelloWorld.java:5: cannot find symbol
symbol : class HttpServletRequest
location: class HelloWorld
public void doGet(HttpServletRequest request,
^
HelloWorld.java:6: cannot find symbol
symbol : class HttpServletResponse
location: class HelloWorld
HttpServletResponse response)
^
HelloWorld.java:7: cannot find symbol
symbol : class ServletException
location: class HelloWorld
throws ServletException, IOException {
^
6 errors
$TOMCAT_HOME/lib/servlet-api.jar:$TOMCAT_HOME/lib/jsp-api.jar:$TOMCAT_HOME/lib
- 01-03-2011, 01:12 PM #4
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Do not use the CLASSPATH environment variable, use the -cp option, and, also, TOMCAT_HOME is liable to be defined only within the running instance of Tomcat making the path used on the provided path "/lib/servlet-api.jar" which, obviously, is not correct.
- 01-03-2011, 01:20 PM #5
Senior Member
- Join Date
- Feb 2009
- Posts
- 117
- Rep Power
- 0


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks