Trouble compiling a Servlet using the JSWDK-1.0.1

I have an old Win95 box on which I had a JDK 1.2 install and I then installed the JSWDK-1.0.1. I have the servlet.jar and jspengine.jar files in the "\lib" directory and have added them to my classpath.
I created a simple servlet but it does not read any classes from the JSWDK .jar files and throws an error saying class HTTPServlet not found. The first few lines of my servlet look like:
import javax.servlet.*;
import javax.servlet.http.*;
public class TestServlet extends HTTPServlet
Any idea why the "javac" compiler cant see the class from the proper jar file? I am using JBuilder as my source code editor and it too shows all the servlet related class/package names in red (i.e. doesnt recognize them).
Regular java apps compile and run fine on this machine.

Hi,
It should be definitely a CLASSPATH problem. You can double check the CLASSPATH in command prompt like this
echo %CLASSPATH%
If the CLASSPATH is set properly, you should see something like this
c:\jdk1.2\lib\tools.jar;c:\jswdk-1.0.1\lib\servlet.jar
Hope this helps.
Best Luck!
Senthil Babu J

Similar Messages

  • How to compile and run a Java servlet using the BEA weblogic server

              Hi,
              Could you help me out as to how to compile a servlet using Web Logic server.I have written a Servlet program and have also set up the environment in the "c:\bea\wlserver6.0\config\examples" folder by giving the command setExamplesEnv.cmd.
              I have stored my GreetingServlet.java file in "c:\bea\wlserver6.0\samples\examples\servlets" folder.
              How do I compile my servlet now?
              Vid
              

    Hello,
    1. The .form file was used by Netbean's GUI builder to create the .java and is not needed for compilation.
    2..../src # javac -classpath "..." mytool/*.java
    I guess the package mytool was not coped with.
    Alternatively it is worth to use the ant build tool also used by Netbeans.
    Then you can make a jar from the class files, indicate in the manifest.mf file:
    1. the main class
    2. the library jars

  • [svn] 2768: sanity and error tests have been moved to asc/test/compiler/ and now use the runtests.py script to execute

    Revision: 2768
    Author: [email protected]
    Date: 2008-08-06 14:28:35 -0700 (Wed, 06 Aug 2008)
    Log Message:
    sanity and error tests have been moved to asc/test/compiler/ and now use the runtests.py script to execute
    Removed Paths:
    flex/sdk/trunk/modules/asc/test/errors-and-warnings/
    flex/sdk/trunk/modules/asc/test/sanity/

    Answered myself. JUst named the imput fields incorrectly.
    Couple of other problems also but sorted and now working
    fine...

  • Trouble compiling java files inside the packages.

    Hello I have a question in Java when compiling with packages. Can anyone Help??
    My 2 java files BeerSelect2.java & BeerExpert.java are in packages com.example.web & com.example.model respectively.
    C:\MyProjects\beerV1\src\com\example\web\BeerSelect2.java
    and
    C:\MyProjects\beerV1\src\com\example\model\BeerExpert.java
    I have compiled the BeerExpert.java in the model package.(ie the class file for BeerExpert is in the com.example.model package.)
    My BeerSelect2 file which is inside the web folder is like this
    package com.example.web;
    import com.example.model.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    public class BeerSelect2 extends HttpServlet
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
    response.setContentType("text/html");
    PrintWriter out=response.getWriter();
    out.println("Beer Selection Advice<br>");
    String c=request.getParameter("color");
    out.println("<br> Got Beer color "+c);
    BeerExpert be=new BeerExpert();
    List result=be.getBrands(c);
    response.setContentType("text/html");
    out.println("BEER SELECTION ADVICE <br>");
    Iterator it=result.iterator();
    while(it.hasNext())
    out.print("<br> try: "+it.next());
    This shows 3 comile errors.
    & the BeerExpert.java file which is in the model folder is like this:
    package com.example.model;
    import java.util.*;
    public class BeerExpert
    public List getBrands(String color)
    List brands=new ArrayList();
    if(color.equals("amber"))
    brands.add("Jack Amber");
    brands.add("Red Moose");
    else
    brands.add("Jale pale Ale");
    brands.add("Gout Stout");
    return (brands);
    This compiles fine in the model folder.
    Now when I'm trying to compile my BeerSelect2.java in the 'web' folder in which I'm trying to import the com.example.model.* which is as follows
    C:\MyProjects\beerV1\src\com\example\web>javac BeerSelect2.java
    which gives 3 errors like this
    BeerSelect2.java:3: package com.example.model does not exist
    import com.example.model.*
    ^
    BeerSelect2.java:22:cannot find symbol
    symbol: class BeerExpert
    location: class com.example.web.BeerSelect2.
    BeerExpert be=new BeerExpert();
    ^
    BeerSelect2.java:22:cannot find symbol
    symbol: class BeerExpert
    location: class com.example.web.BeerSelect2.
    BeerExpert be=new BeerExpert();
    ^
    Can anyone help???

    Since the classes are part of the com.example.web and com.example.model packages the most straight forward way to compile is from the folder containing "com". Assuming you want the resulting .class files to be in the same folders are their associated .java source files:
    C:\MyProjects\beerV1\src\> javac -cp . com\example\model\BeerExpert.java
    C:\MyProjects\beerV1\src\> javac -cp . com\example\web\BeerSelect2.javaThe -cp . part is there to set the classpath (the location that the compiler will use to locate java classes) and thereby let the compiler make sense of the import statements.
    The presence of "src" in the directory path strongly suggests, however, that the intention is not to have source and class files end up in the same directory. If this is the case read up on the syntax of the http://download.oracle.com/javase/6/docs/technotes/tools/windows/java.html (java.exe) and http://download.oracle.com/javase/6/docs/technotes/tools/windows/javac.html (javac.exe) commands. (paying attention to how searching for types is done). Also read up on any documentation you were given for building the application (if you are modifying something already given).
    If you are using an IDE you should say.

  • Trouble compiling a servlet

    This may be a dumb question, but is there any way to compile a servlet without using ant?

    nevermind, I got it...

  • Can somebody solve the resizing wallpaper for me?? It is a big trouble. I cannot use the wallpaper I want!!!

    Every time I want to use my familiy's picture as my wallpaper. It changes the size of my pic automatically. It makes the pic bigger and ugly!  And I cannot change it any more! It really annoys me.  Can anybody fix this?? I know this problem has been a long time. What's wrong?? Help please.

    Why your wallpapers look messed up on iOS 7, and how to fix them!
    http://www.imore.com/having-issues-wallpapers-ios-7-heres-why-and-how-fix-it
    How to Change iPad Wallpaper and Grab or Save Images from the Web
    http://portables.about.com/od/newsandviews/ss/iPad-tutorials_5.htm
    You could use the free Instafit app https://itunes.apple.com/us/app/instafit-post-photos-to-instagram/id591706840?mt =8
     Cheers, Tom

  • Having trouble with Photoshop Elements using the Adobe e-mail service

    Can anyone offer any helpful information?

    Hi Hayzal,
    Please refer the KB : http://helpx.adobe.com/elements-organizer/using/sending-photos-media-files-email.html

  • How to compile a servlet

    I am trying to compile a servlet using the import javax.servlet.*;
    import javax.servlet.http.*; packages. But the only thing I keep getting is :
    BasicServlet.java:1: package javax.servlet does not exist
    import javax.servlet.*;
    ^
    BasicServlet.java:2: package javax.servlet.http does not exist
    import javax.servlet.http.*;
    ^
    BasicServlet.java:6: cannot resolve symbol
    symbol : class HttpServlet
    location: class BasicServlet
    public class BasicServlet extends HttpServlet
    I have included the servletapi2_1_1-win package from the sun site containing the servlet.jar in my classpath. Still it refuses to compile. Besides does anybody know how to compile using the servlet packages available in Tomcat or j2ee, both of which I have on my machine , but can't figure what to include.
    Please help.
    ^

    have you actually included the servlet.jar file in your classpath or just the directory, as you need to explicity declare jar files in the classpath...
    javac -classpath %CLASSPATH%;C:\[servlet-jar-path]\servlet.jar Servlet.class

  • Compiling a servlet with utility class

    Hello,
    I am having trouble compiling a servlet that uses a utility class.
    The compiler doesn't seem to recognize the utility class for some reason.
    my classpath is set to:
    .;C:\ServletDevel;C:\Program Files\Apache Software Foundation\common\lib\servlet-api.jar
    the error:
    Cannot find symbol: ServletUtilities
    the servlet code:
    package coreservlets;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    /** test the use of packages and utilities on the server */
    public class helloservlet3 extends HttpServlet {
    public void doGet(HttpServletRequest request,
                   HttpServletResponse response)
                   throws ServletException, IOException {
         response.setContentType("text/html");
         PrintWriter out = response.getWriter();
         String title = "Hello (3)";
         out.println(ServletUtilities.headWithTitle(title) +
              "<body bgcolor=\"#FDF5E6\">\n" +
              "<h1>" + title + "</h1>\n" +
              "</body></html>");
    the utility class:
    package coreservlets;
    import javax.servlet.*;
    import javax.servlet.http.*;
    /** time saving static methods */
    public class ServletUtilities {
         public final static String docType =
         "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
         "Transitional//EN\">";
    public static String headWithTitle(String title){
    return (docType + "\n" + "<html>\n" +
              "<head><title>" + title + "</title></head>\n");
    any help wouldbe greatly appreciated.

    Nope still getting an error
    helloservlet3.java:17:cannot find symbol
    symbol : class ServletUtilities
    location: package coreservlets
    out.println(coreservlets.ServletUtilities.headWithTitle(title) +
    thanks for the help, i'll keep on trying to figure it out.

  • Cannot run a servlet in the IDE.

    Under which webapps we need to put the file folders of my project.
    I cannot run the servlet It gets deployed and
    if I try to invoke the servlet using the url name it gives
    this error
    [30/Nov/2004:17:08:41] WARNING ( 5996): for host 127.0.0.1 trying to GET /appshub, send-file reports: HTTP4142: can't find C:/Sun9/jstudio/AppServer7/domains/domain1/server1/applications/j2ee-modules/project_3/appshub (File not found)
    Every time I do a deploy it creates a new instance ../project_1/appshub
    second time ../project_1/appshub
    please help with this problem..
    Vijay

    Hi Vijay
    You need to create the servlets under WEB-INF->classes tree.
    Here is the structure of a simple web module shown in FIle System tab of IDE
    -/export/home/JSEApps/MyApp
    -- WEB-INF -->classes-->mypackage-->MyServlet
    -- MyJsp
    Once you created and compiled the servlets like this, right click on WEB-INF folder in the IDE and change the context root property to /myapp . Again right click on WEB-INF and deploy.
    Now you can access the servlet with http://server:port/myapp/servlet/ MyServlet
    Check the documentation @ http://docs.sun.com/source/817-2334/index.html on how to build web componets.
    check this for complete documentation. http://docs.sun.com/app/docs/coll/790.6
    Check few samples @ http://developer.sun.com/prodtech/javatools/jsenterprise/learning/tutorials/index.html
    Let me know if you need more.
    Thanks
    Srini

  • Setting a deployment context when using the embedded OC4J

    I'm trying to debug a servlet using the embedded OC4J server. I have a simple project that includes a servlet source file and and a web.xml file. The web.xml file defines context
    parameters that I want the servlet to read and use when it is deployed. However I don't know
    how to get JDeveloper to set up the servlet context on the debugging environment to use the
    contents of the web.xml file. Could anyone tell me how to do this? I cannot see how to
    do this from the help files.
    Many thanks in advance

    The trick is to ensure that you use a 'Project with Web Module' rather than
    'Empty Project' and then add a new 'HTTP Servlet'. When you do this
    JDeveloper automatically creates a web.xml file. You can add context
    parameters, or practically any other configuration items by right clicking
    on the web.xml tree node inthe system navigator and selecting settings.
    The web.xml file is saved into the directory specified by the 'HTML Root Directory' on the 'Input Paths' panel in the project settings dialog.

  • Communication with servlet using HTTPURLConnection

    Hi Again,
    well..trying to connect to a servlet using the HTTPURLConnection class.
    but the servlet is found (as i have put a system.out in init method of the servlet and that gets printed correctly).my problem is that the doget method does not get invoked.
    following is the code:
    client side:
    public class test
    public test()
    ObjectOutputStream outs=null;
    try
    URL url = new URL("http://127.0.0.1:7001/DataFetchServlet");
    HttpURLConnection urlcon = (HttpURLConnection)url.openConnection();
    System.out.println(urlcon.toString());
    urlcon.setRequestProperty("Content-Type","application/octet-stream");
    urlcon.setRequestMethod("GET");
    urlcon.setDoInput(true);
    urlcon.setDoOutput(true);
    urlcon.setUseCaches(true);
    outs = new ObjectOutputStream(urlcon.getOutputStream());
    String str = new String("hello");
    outs.writeObject(str);
    ObjectInputStream inp = new ObjectInputStream (urlcon.getInputStream());//********************
    outs.flush();
    outs.close();
    catch(Exception e)
         e.printStackTrace();
    //******************** THIS LINE GIVES A FILENOTFOUND EXCEPTION
    I am sure the servlet is found before the object is written but after the getInputStream it throws the excpetion..
    can anyone help?????
    THanx in advance

    urlcon.connect();

  • Executing tiny programming language compiled byte code with the JVM

    Hello,
    For a project, I am developing a simple programming language, with a syntax not unlike Pascal, which compiles to Java Byte Code. Currently I execute the compiled byte code using my own interpreter. This works OK, but what I'd like to do now is to execute the compiled byte code using the actual existing JVM. The compiled byte code resides in a text file upon compilation of a sample program written in my tiny programming language. Does anyone know how I may start to go about this? Thanks in advance.
    adam

    The only way of getting a standard Java virtual machine to execute your java byte code, is to wrap it up into a completely valid java class file.
    Any constants you use, must be put into the classes constant pool.
    Any local variables will have to go into the local variable table of the method which uses them... etc, etc.
    Something like ASM, would let you dynamically create a Java class file.
    http://asm.objectweb.org/
    regards,
    Owen

  • Trouble compiling servlet example

    Hi All, I am trying out an example for servlets and I ran into trouble compiling the the file called "FormProcessingServlet.java" in tutorial located here: http://developer.java.sun.com/developer/onlineTraining/Servlets/Fundamentals/magercises/FormPostingAndProcessing/index.html
    The exact problem happens in this line:
    isStructure = context.getResourceAsStream(paramStructureFile[0]);
    The error says:
    FormProcessingServlet.java:127: cannot resolve symbol
    symbol : method getResourceAsStream (java.lang.String)
    location: interface javax.servlet.ServletContext
    isStructure = context.getResourceAsStream(paramStructureFile[0]);
    anyone else ran into this problem? How do I fix this? Thanks.

    "cannot resolve symbol" means that the JVM can't find a particular class.
    Adjust your systems classpath variable to include all the jar files that you use, I also add "." to include files in the current directory I'm working from.

  • Why can''t I use the Servlet class?

    I am trying to build a Servlet by extending HttpServlet. I imported java.io.*, javax.servlet.*, and javax.servlet.http.*. When I compile, it tells me the Servlet packages were not found in import. I am using JDK 1.3. What version do I need to use these packages?

    Ok, and you are sure the name, servlet.jar, is in the classpath, and not just the path to the servlet.jar. E.g.
    mypath/servlet.jar (and not just mypath/).
    It must be a classpath problem if it can't find the package. You could also try to compile your class with the -classpath option:
    java -classpath mypath/servlet.jar *.java
    and see if that helps. Or look inside the servlet.jar to verify that it has the packages you need.

Maybe you are looking for

  • If I buy any iPhone can it still work as an iPod touch without the phone carrier? Will it work normal?

    So what if I bought an iPhone 4 or 5 off craigslist because it was cheaper than a 5th generation iPod. Would it still work as an iPod without a phone carrier?

  • Problems merging PDF's with Preview

    Hi there, I'm on 10.8.5, with Preview Version 6.0.1 (765.6).  I have followed all of the steps to merge pdf's. In the title bar of the document it says there are two pages.  Then I save (there is no save as command) and it only saves one page.  Is th

  • Nokia 7373 turning off/memory

    Hey All, not sure if you can help but my phone was great at the start, stored loads of messages etc. but now its started turning its self off and then when i turn it back on all my text messages in my in box (not sent etc) have been deleted. also now

  • Help needed with Safari CSS issues

    Hi Everyone I'm not sure if this is the best forum to post this in - but couldn't find anywhere more appropriate! My site, neilcauldwell.com, is suffering from two issues in Safari (it looks fine in IE6/7, FF and Opera); 1. The 'Blog' page is suppose

  • SOAP/WSDL builder for C programming

    Dear guru, is any possibility or can you give any hint if exist some SOAP/WSDL builder for creating C libraries from SOAP/WSDL and vice versa? Thanks a lot for help. Regards, Roman