Results 1 to 5 of 5
  1. #1
    kulangotski is offline Senior Member
    Join Date
    Feb 2009
    Posts
    117
    Rep Power
    0

    Default 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

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    It might help to define "won't work".

  3. #3
    kulangotski is offline Senior Member
    Join Date
    Feb 2009
    Posts
    117
    Rep Power
    0

    Default

    oh im sorry.

    this is the class I have been trying to compile

    import 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");
    }
    }
    then I try to use javac but it gives me this kind reply

    HelloWorld.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
    and if I am right the classpath is directly pointing to the servlet-api.jar

    $TOMCAT_HOME/lib/servlet-api.jar:$TOMCAT_HOME/lib/jsp-api.jar:$TOMCAT_HOME/lib

  4. #4
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    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.

  5. #5
    kulangotski is offline Senior Member
    Join Date
    Feb 2009
    Posts
    117
    Rep Power
    0

    Default

    thanks masijade, I was just trying all the examples over the net that is working with this problem. well thanks for the info. appreciate it. got it working now :D

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •