Package javax.swing.event not found in import.

I'm receiving the above error message when compiling a Java application which begins with the following import statements:
* 1.1+Swing version.
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
My Classpath System variables are as follows:
C:\IBMCON~1\CICS\Classes\CTGCLI~1.JAR;.;C:\PROGRA~1\MQSeries\java\lib\COMIBM~2.JAR;C:\PROGRA~1\MQSeries\java\lib\COMIBM~1.JAR;C:\PROGRA~1\MQSeries\java\lib\COMIBM~3.JAR;C:\PROGRA~1\MQSeries\tools\javaclnt\samples\en_us;C:\Program Files\SQLLIB\java\db2java.zip;C:\Program Files\SQLLIB\java\runtime.zip;C:\Program Files\SQLLIB\bin;C:\Program Files\SQLLIB\java\SQLj.zip
I have Java(TM) 2 SDK, Standard Edition, Version 1.4.0 installed and am running Windows 2000.
I'd appreciate any ideas as to why this compiler error occurs. Thanks very much.

What error message?
As stated, looks like something's not where it's supposed to be.
Here's the search order of your classpath:
C:\IBMCON~1\CICS\Classes\CTGCLI~1.JAR
C:\PROGRA~1\MQSeries\java\lib\COMIBM~2.JAR
C:\PROGRA~1\MQSeries\java\lib\COMIBM~1.JAR
C:\PROGRA~1\MQSeries\java\lib\COMIBM~3.JAR
C:\PROGRA~1\MQSeries\tools\javaclnt\samples\en_us
C:\Program Files\SQLLIB\java\db2java.zip
C:\Program Files\SQLLIB\java\runtime.zip
C:\Program Files\SQLLIB\bin
C:\Program Files\SQLLIB\java\SQLj.zip

Similar Messages

  • Class javax.rmi.PortableRemoteObject not found in import

    I have successfully tested test1.jsp calling stateful ejb test1ejb under JDEV9032. On deploying to standalone OC4J903, the following error occurred on accessing the jsp:
    500 Internal Server Error
    OracleJSP: oracle.jsp.provider.JspCompileException:
    Errors compiling:D:\O9IAS\j2ee\home\application-deployments\test\testWEB\persistence\_pages\\_test1.java
    Line # Error 10
    Class javax.rmi.PortableRemoteObject not found in import. import javax.rmi.PortableRemoteObject;
    Appreciate some pointers on how to troubleshoot this problem. Thanks. William Chew.

    This error is due to the c:\windows\system32\java.exe being first on the path instead of the d:\jdev9i\jdk\bin\java.exe being picked up.

  • Class javax.crypto.SecretKey not found in import.

    While compilation i am getting this error.
    Class javax.crypto.SecretKey not found in import.
    I am not able to figure it out . Please help me for that.
    Is it related to some classpath setting.

    This error is due to the c:\windows\system32\java.exe being first on the path instead of the d:\jdev9i\jdk\bin\java.exe being picked up.

  • Javax.xml.parsers not found in import

    I have downloaded JAXP from java.sun.com. I put the jar files in ../jdk/jre/lib/ext/.
    Im getting "javax.xml.parsers not found in import" when I try to compile a program with an import statement like this:
    import javax.xml.parsers.*;
    What am i missing? My classpath has ../jdk/jre/lib/ext/ in it..

    I have downloaded JAXP from java.sun.com. I put the
    jar files in ../jdk/jre/lib/ext/.
    Im getting "javax.xml.parsers not found in import"
    when I try to compile a program with an import
    statement like this:
    import javax.xml.parsers.*;
    What am i missing? My classpath has
    ../jdk/jre/lib/ext/ in it..Hi,
    This seems to be a classpath problem. You can also use JDK1.4.1
    which has crimson bundled with it. So you do not need to do any explicit settings for classpath.
    Pls let me know if you still have problems
    Thanks,
    Bhakti

  • Package javax.mail.* not found

    Hello.
    I've got a problem with a program in which I wanted to use the JavaMail-API. I've added the path of the needed jar-files into the CLASSPATH. But when I compile my application I get the error that the package java.mail.* was not found.
    I've also tried it with the JBuilder5 and then I got the followed error message:
    Error #: 302 : No access on the class javax.mail.Session; class javax.mail.Session was not found in a stable package
    What did I do wrong? Please help me.

    The problem is evident, the class you want to use is not in class path. There is no dilemma over that.
    How can you check that the class is in classpath.
    you can use javap command
    If you are using WIN NT /200o you can use the command
    javap with fully qualified name of the class e.g.
    to find if the class String is in classpath
    ==> javap java.lang.String
    This will print all the methods of the class on the DOSpromt. Similarly you can check
    javap javax.mail.Session
    if it doesnot find the class, the class is definitely not in classpath. You can set the class path as: -
    set classpath = %classpath%;"path of mail.jar"
    if mail.jar is located in say c:\jdk1.3\lib\mail.jar
    set the classpath as :-
    set classpath = %classpath%;C:\jdk1.3\lib\mail.jar;C:\jdk1.3\lib\activation.jar
    Now check with javap it is working now and now you can compile you code.
    Hope this helps

  • Class not found in import

    I am new to the Java technology and am running into some problems getting started. Initially, I was getting the following error: Class javax.swing.JOptionPane not found in import. After realizing that I needed to unzip the src.zip file, I did so. I tried compiling again and got the same message. I came across a website that talked about setting the CLASSPATH. So I set the class path like so: set CLASSPATH=.;C:\;c:\j2sdk1.4.2_04\src;. Finally! I got passed the first error. However, what followed was quite depressing. 50 Errors! Looks like the compiler can not find any class I import that starts with "sun.". I looked where I can see the javax folder and there is no sun folder. Did I miss something in the installation? Is there a workaround for this? I thought I read somewhere that you shouldn't import sun.* classes, but what happens when it is in the delivered packages? TIA Ryan

    Well to start off... The file Src.zip only contains source files nothing compiled so it useless unless you want to look at the source code, the Java Class files are in a "Jar" file...
    Set your (system) path to c:\j2sdk1.4.2_04\bin
    your ClassPath should only point to the new class files that you created...
    ( I don't even have the ClassPath set on my computer)
    And this link deals with setting the classpath...
    http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/classpath.html
    That should take care of it... Here are some links for you to check out...
    The Java Tutorial
    http://java.sun.com/docs/books/tutorial/index.html
    Essentials of the Java Programming Language: A Hands-On Guide, Part 1 and 2
    http://java.sun.com/developer/onlineTraining/Programming/BasicJava1/
    http://java.sun.com/developer/onlineTraining/Programming/BasicJava2/
    Language Essentials Short Course
    http://java.sun.com/developer/onlineTraining/JavaIntro/contents.html
    Tutorial Index
    http://java.sun.com/developer/onlineTraining/index.html
    - MaxxDmg...
    - ' He who never sleeps... '

  • Package javax.persistence does not exist

    Hi, I'm a beginner on Weblogic, sorry my so simple and basic question (and my bad english). But I'm trying to build the weblogic examples ("ant build", as the documentation says) and got error messages like this:
    Buildfile: build.xml
    clean:
    init:
    [mkdir] Created dir: /opt/bea/wlserver_10.3/samples/server/examples/src/examples/ejb/ejb30/build/META-INF
    [copy] Copying 1 file to /opt/bea/wlserver_10.3/samples/server/examples/src/examples/ejb/ejb30/build/META-INF
    [copy] Copying 1 file to /opt/bea/wlserver_10.3/samples/server/examples/src/examples/ejb/ejb30/build/META-INF
    [echo] ======================================================
    [echo] Building EJB 3.0 Samples
    [echo] ======================================================
    [echo] Base directory : /opt/bea/wlserver_10.3/samples/server/examples/src/examples/ejb/ejb30
    [echo] Samples Home : /opt/bea/wlserver_10.3/samples
    [echo] Deployed Target : /opt/bea/wlserver_10.3/samples/server/examples/build/ejb30/reviewService.ear
    compile:
    [javac] Compiling 38 source files to /opt/bea/wlserver_10.3/samples/server/examples/src/examples/ejb/ejb30/build
    [javac] /opt/bea/wlserver_10.3/samples/server/examples/src/examples/ejb/ejb30/src/java/examples/ejb/ejb30/domain/Artist.java:6: package javax.persistence does not exist
    [javac] import javax.persistence.*;
    [javac] ^
    [javac] /opt/bea/wlserver_10.3/samples/server/examples/src/examples/ejb/ejb30/src/java/examples/ejb/ejb30/domain/Person.java:7: package javax.persistence does not exist
    I suppose that there is some "jar" containing "javax.persistence" that should be included in some classpath
    on build.xml file, but I didn't find such "jar". I found in documentation that persistence is also implemented using
    the Kodo software, an may be I should configure it, but I don't know how. Can someone help me building the
    Weblogic examples?
    Thanks.

    Hi,
    Here the result of :
    echo "CLASSPATH" in windows after running setWLS.Env.cmd
    C:\bea\patch_wlw1030\profiles\default\sys_manifest_classpath\weblogic_patch.jar;
    C:\bea\patch_wls1030\profiles\default\sys_manifest_classpath\weblogic_patch.jar;
    C:\bea\patch_jdev1111\profiles\default\sys_manifest_classpath\weblogic_patch.jar;
    C:\bea\patch_cie660\profiles\default\sys_manifest_classpath\weblogic_patch.jar;
    C:\bea\JROCKI~1\lib\tools.jar;C:\bea\WLSERV~1.3\server\lib\weblogic_sp.jar;
    C:\bea\WLSERV~1.3\server\lib\weblogic.jar;
    C:\bea\modules\features\weblogic.server.modules_10.3.0.0.jar;
    C:\bea\WLSERV~1.3\server\lib\webservices.jar;
    C:\bea\modules\ORGAPA~1.5/lib/ant-all.jar;
    C:\bea\modules\NETSFA~1.0_1/lib/ant-contrib.jar;
    C:\bea\patch_wlw1030\profiles\default\sys_manifest_classpath\weblogic_patch.jar;
    C:\bea\patch_wls1030\profiles\default\sys_manifest_classpath\weblogic_patch.jar;
    C:\bea\patch_jdev1111\profiles\default\sys_manifest_classpath\weblogic_patch.jar;
    C:\bea\patch_cie660\profiles\default\sys_manifest_classpath\weblogic_patch.jar;
    C:\bea\JROCKI~1\lib\tools.jar;
    C:\bea\WLSERV~1.3\server\lib\weblogic_sp.jar;
    C:\bea\WLSERV~1.3\server\lib\weblogic.jar;
    C:\bea\modules\features\weblogic.server.modules_10.3.0.0.jar;
    C:\bea\WLSERV~1.3\server\lib\webservices.jar;
    C:\bea\modules\ORGAPA~1.5/lib/ant-all.jar;
    C:\bea\modules\NETSFA~1.0_1/lib/ant-contrib.jar;
    C:\Program Files\Java\jre1.6.0_07\lib\ext\QTJava.zip
    Hope it will help
    can you past the content of you script setWLSEnv.sh?
    Also try with the script setExamplesEnv.sh under C:\bea\wlserver_10.3\samples\domains\wl_server (for windows) the equivalent of Unix
    Thanks

  • ANT script genrated error: package javax.servlet does not exist

    Hi there,
    I am running ANT and confronted this message:
        [javac] Compiling 1 source file to C:\eclipseProjects\tomcat_test
        [javac] C:\eclipseProjects\tomcat_test\WEB-INF\src\WebTest.java:4: package javax.servlet does not exist
        [javac] import javax.servlet.ServletException;
        [javac] ^I googled around and found this solution:
    servlet-api.jar is the jarfile that contains javax.servlet.ServletException and javax.servlet.http.* which are imported by WebTest.java and must therefore be found in the classpath. If javac doesn't find this jar (or the javax.servlet packages), it will say (or shout, depending on my and javac's mood): [the error message]
    well...I set in the classpath the location of the servlet-api.jar
    (found at: C:\Tomcat\common\lib)
    I set it with the environment variable (windows xp)
    Just as it's shown here: http://www.cs.usask.ca/~wew036/latex/env-env.jpg
    NOTHING :-(
    could anyone assist, thanks

    Hi..seems u r new to J2ee.. dont worry its a very small problem:
    Here is the solution.. yes u have to edit the environment variables:..
    I am using J2EE sdk 1.4 and running on xp
    This is the classpath setting:
    C:\Sun\AppServer\lib\j2ee.jar;
    This is the PATH setting
    C:\Sun\AppServer\bin;
    Good Luck :)

  • Package javax.swing not found in import!

    I recently installed JDK 1.3.1_02 on WinNT4.0 and I cannot compile javax
    packages without getting the following error:
    Package javax.swing not found in import
    I've tried every combination of modifying the CLASSPATH system variable
    I can think of. I have no problem compiling java packages but not
    javax packages. I followed the installation instructions to the letter.
    What am I missing? Surely someone is running the same version of
    the JDK I am on WinNT 4.0.

    Thanks again!!! I had an older version of javac running on my system any time I ran
    outside of the bin where the latest javac was installed. I removed the older version
    of the jdk and now I can compile from any directory. I really appreciate the help,
    I was wracking my brain.
    By the way, -version is not a valid flag for javac.exe, although it is for java.exe.
    signed,
    grateful in cyberspace

  • Package com.sun.java.swing not found in import

    I'm trying to show graphic information but the swing package does not load up don't know what is going on Any help is welcome
    THIS IS THE LINE I GET WHEN I TRY TO IMPORT SWING
    Package com.sun.java.swing not found in import

    I'm trying to show graphic information but the swing
    package does not load up don't know what is going on
    Any help is welcome
    THIS IS THE LINE I GET WHEN I TRY TO IMPORT SWING
    Package com.sun.java.swing not found in importThat's an old package reference. Try javax.swing

  • Package javax.mail not found in import.

    hi,
    i am trying to develop a mail application using jsp, i have jaf1.0.1 and javamail API and the application was working fine on weblogic but when i tried to do the same thing on Apache server the Package javax.mail not found in import. is occuring,
    What could be the problem can any one explain...
    Thanks

    I think you have not placed mail.jar and activation.jar files in the /jre/lib/ext directory. Just place the mail.jar and activation.jar files in the jdk's /jre/lib/ext directory and check out. This will work for you.
    Rkanthj

  • Package not found in import

    Hello, I�m trying to run a webapplication but I get an Error 500-message in the browser(IE 5): Package not found in import. It is an webapplication with JSPs and an controlling servlet. Does anyone know how to fix that problem?
    Using: Windows 2000, Tomcat 3.2.1 as NT-service, JavaTM 2 SDK, Enterprise Edition, JavaTM 2 SDK, Standard Edition
    Tomcat/webapps/projektverwaltung.war
    Error: 500
    Location: /projektverwaltung/projektverwaltung/JSP/Menue.jsp
    Internal Servlet Error:
    org.apache.jasper.JasperException: Unable to compile class for JSPC:\Tomcat\work\localhost_8080%2Fprojektverwaltung\_0002fprojektverwaltung_0002fJSP_0002fMenue_0002ejspMenue_jsp_0.java:15: Package de.zebulon.projektverwaltung.projekttool not found in import.
    import de.zebulon.projektverwaltung.projekttool.*;
    ^
    1 error
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:254)
         at org.apache.jasper.servlet.JspServlet.doLoadJSP(JspServlet.java:462)
         at org.apache.jasper.servlet.JasperLoader12.loadJSP(JasperLoader12.java:146)
         at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:433)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:152)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:164)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
         at org.apache.tomcat.core.Handler.service(Handler.java:286)
         at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
         at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
         at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
         at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
         at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
         at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
         at java.lang.Thread.run(Thread.java:484)
    CLASSPATH: .;C:\;C:\jesdkee1.3\lib\j2ee.jar;C:\jdk1.3.0_01\lib\tools.jar;C:\Tomcat\lib\servlet.jar;C:\de\zebulon\projektverwaltung\projekttool;
    J2EE_CLASSPATH:
    C:\mysql\JDBC_MySQL_mm\mm.mysql-2.0.4-bin.jar;C:\mysql\JDBC_MySQL_Resin\caucho-jdbc-mysql-0.2.2.jar;C:\mysql\JDBC_MySQL_twz\twz1\jdbc\mysql\htdocs\twz1jdbcForMysql.jar;
    J2EE_HOME:
    C:\j2sdkee1.3;
    JAVA_HOME:
    C:\jdk1.3.0_01;
    TOMCAT_HOME:
    C:\tomcat;
    Path:
    C:\PROGRA~1\Borland\Delphi5\Projects\Bpl;C:\PROGRA~1\Borland\Delphi5\Bin;C:\PROGRA~1\BORLAND\CBUILD~1\BIN;C:\PERL\BIN;"%PATH%";%SYSTEMROOT%;%SYSTEMROOT%\system32;%SYSTEMROOT%\system32\WBEM;C:\jdk1.3.0_01\bin;C:\j2sdkee1.3\bin;C:\j2sdkee1.3\lib\j2ee.jar;C:\mysql\bin;
    Server.xml entry:
    <Context path="/projektverwaltung"
    docBase="webapps/projektverwaltung"
    defaultSessionTimeOut="30"
    debug="9">
    </Context>
    Web.xml:
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE web-app PUBLIC
    "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
    <web-app>
    <display-name>Projektverwaltung Zebulon</display-name>
    <description>Interne Projektverwaltung Fa. Zebulon</description>
    <welcome-file-list>
    <welcome-file>menue.jsp</welcome-file>
    </welcome-file-list>
    <servlet>
    <servlet-name>ProjektServlet</servlet-name>
    <display-name>ProjektServlet</display-name>
    <description>Servlet das die Applikation kontrolliert</description>
    <servlet-class>de.zebulon.projektverwaltung.projekttool.ProjektServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <url-pattern>/Projekttool</url-pattern>
    <servlet-name>ProjektServlet</servlet-name>
    </servlet-mapping>
    <session-config>
    <session-timeout>30</session-timeout>
    </session-config>
    </web-app>

    Hello, I try copy C:\de\zebulon\projektverwaltung\projekttool\*.class in
    location that contain file _002fprojektverwaltung_0002fJSP_0002fMenue_0002ejspMenue_sp_0.java.

  • Package org.apache.axis.message not found in import.

    Hi,
    I am using axis to give response to another bpel process after any operation is completed of a BPEL process.I am using JDeveloper to deploy my bpel process.It has succesfully deployed process without any error but when bpel server is unpacking it and deploying it to oc4j,it get error:
    Package org.apache.axis.message not found in import.
    06/02/08 12:40:40 import org.w3c.dom.Element;import java.util.Calendar;import java.util.Date;import com.collaxa.cube.engine.ext.process;
    import com.oracle.services.bpel.task.*;import com.oracle.bpel.client.BPELFault;import com.collaxa.cube.xml.schema.XMLSchemaUtils;import com.
    oracle.bpel.client.util.WhereCondition;import com.oracle.bpel.client.Locator;import com.oracle.bpel.client.delivery.IDeliveryService;import
    com.oracle.bpel.client.NormalizedMessage;import com.oracle.bpel.client.IInstanceHandle;import com.oracle.bpel.client.ServerException;import
    com.oracle.services.bpel.Process.*;import org.apache.axis.message.*;import javax.xml.soap.Name;
    I have manually copied all axis jars to
    1)OraBPEL\integration\orabpel\system\appserver\oc4j\j2ee\home\applib
    2)OraBPEL\integration\orabpel\lib
    But no use.
    Can anybody help!

    I've put a lot og jar files in the bpel-inf/lib but it looks as if they are not in the class path when I need them. The result is a ClassNotFoundException? Do I have to specify anything else? I've put a class in the bpel-inf/classes and it looks to me as if it is found by the BPM.

  • Help - Tomcat - Package not found in import

    Error: 500
    Location: /htmltest/login.jsp
    Internal Servlet Error:
    org.apache.jasper.JasperException: Unable to compile C:\jdk1.3.1\jakarta-tomcat-3.3a\work\DEFAULT\htmltest\login_1.java:5: Package usingjsp not found in import.
    import usingjsp.*;
    ^
    1 error
         at org.apache.tomcat.facade.JasperLiaison.javac(Unknown Source)
         at org.apache.tomcat.facade.JasperLiaison.processJspFile(Unknown Source)
         at org.apache.tomcat.facade.JspInterceptor.requestMap(Unknown Source)
         at org.apache.tomcat.core.ContextManager.processRequest(Unknown Source)
         at org.apache.tomcat.core.ContextManager.internalService(Unknown Source)
         at org.apache.tomcat.core.ContextManager.service(Unknown Source)
         at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown Source)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source)
         at java.lang.Thread.run(Thread.java:484)
    Above is the error I encounter when running my JSP and Servlets combination under Tomcat3.3a
    Can anyone pls tell me basically what error is that?
    The path for my package "usingjsp" is c:\jdk13~1.1\jakart~1.3a\webapps\examples\web-inf\classes\usingjsp
    I put my package under that directory because to my knowledge Tomcat requires all servlet to be put under there by default.
    The path for my JSP file is c:\jdk13~1.1\jakart~1.3a\webapps\htmltest.
    NOTE: I had modified the XML file.
    Under that folder there is 2 classes named LoginServlet and UserDataTable.
    Below are my codes:
    1. logintest.html
    <html>
    <body>
    <form action="login.jsp" method="post">
    <table>
    <tr><td>Username: <td><input type="text" name="username">
    <tr><td>Password: <td><input type="password" name="password">
    </table>
    <input type="submit" value="SUBMIT">
    </form>
    </body>
    </html>
    2. login.jsp
    <%@ page language="java" import="java.util.*" %>
    <%@ page import="usingjsp.*" %>
    <html>
    <body bgcolor="#a3355f">
    <%
         String userName = request.getParameter("username");
         String password = request.getParameter("password");
         String userKey = UserDataTable.createUserData();
         Hashtable userData = UserDataTable.getUserData(userKey);
         userData.put("username", userName);
    %>
    <form action="/examples/servlet/LoginServlet" method="post">
    <input type="hidden" name="userKey" value="<%userKey%>">
    <input type="submit" value="SUBMIT">     
    </form>
    </body>
    </html>
    3. LoginServlet.java
    //package usingjsp;
    import javax.servlet.*;
    import java.io.*;
    import java.util.*;
    public class LoginServlet extends GenericServlet {
         public void service(ServletRequest req, ServletResponse res) throws IOException {
              res.setContentType("text/html");
              PrintWriter out = res.getWriter();
              String userKey = req.getParameter("userKey");
              Hashtable userData = new Hashtable();
              UserDataTable temp = new UserDataTable();
              userData = temp.getUserData(userKey);
              if (userData == null) {
                   out.println("<html>");
                   out.println("<body>");
                   out.println("<h1>SORRY<h1>");
                   out.println("</body>");
                   out.println("</html>");
                   return;
              String userName = (String)userData.get("username");
                   out.println("<html>");
                   out.println("<body>");
                   out.println("<h1>" + userName + "<h1>");
                   out.println("</body>");
                   out.println("</html>");
    4. UserDataTable.java
    //package usingjsp;
    import java.util.*;
    public class UserDataTable {
         protected static Hashtable userData = new Hashtable();
         protected static Random keyGenerator = new Random();
         public static String createUserData() {
              String userKey = "" + keyGenerator.nextLong();
              userData.put(userKey, new Hashtable());
              return userKey;
         public static Hashtable getUserData(String userKey) {
              if (userKey == null) return null;
                   return (Hashtable) userData.get(userKey);
         public static void clearUserData(String userKey) {
              if (userKey == null) return;
                   userData.remove(userKey);
    }Pls let me know if you need more info. Thanks!

    1. login.jsp
    <%@ page language="java" import="java.util.*" %>
    <%@ page import="classes.servlets.*" %>
    <html>
    <body bgcolor="#a3355f">
    <%
         String userName = request.getParameter("username");
         String password = request.getParameter("password");
         String userKey = UserDataTable.createUserData();
         Hashtable userData = UserDataTable.getUserData(userKey);
         userData.put("username", userName);
    %>
    <form action="/classes/servlet/LoginServlet" method="post">
    <input type="hidden" name="userKey" value="<%userKey%>">
    <input type="submit" value="SUBMIT">     
    </form>
    </body>
    </html>
    2. UserDataTable.java
    package classes.servlets;
    import java.util.*;
    public class UserDataTable {
         protected static Hashtable userData = new Hashtable();
         protected static Random keyGenerator = new Random();
         public static String createUserData() {
              String userKey = "" + keyGenerator.nextLong();
              userData.put(userKey, new Hashtable());
              return userKey;
         public static Hashtable getUserData(String userKey) {
              if (userKey == null) return null;
                   return (Hashtable) userData.get(userKey);
         public static void clearUserData(String userKey) {
              if (userKey == null) return;
                   userData.remove(userKey);
    3. LoginServlet.java
    package classes.servlets;
    import javax.servlet.*;
    import java.io.*;
    import java.util.*;
    public class LoginServlet extends GenericServlet {
         public void service(ServletRequest req, ServletResponse res) throws IOException {
              res.setContentType("text/html");
              PrintWriter out = res.getWriter();
              String userKey = req.getParameter("userKey");
              Hashtable userData = new Hashtable();
              UserDataTable temp = new UserDataTable();
              userData = temp.getUserData(userKey);
              if (userData == null) {
                   out.println("<html>");
                   out.println("<body>");
                   out.println("<h1>SORRY<h1>");
                   out.println("</body>");
                   out.println("</html>");
                   return;
              String userName = (String)userData.get("username");
                   out.println("<html>");
                   out.println("<body>");
                   out.println("<h1>" + userName + "<h1>");
                   out.println("</body>");
                   out.println("</html>");
    }I had added CLASSPATH=c:\jdk13~1.1\jakart~1.3a\webapps\internet\web-inf into autoexec.bat.
    I had been able to compile UserDataTable.java and LoginServlet.java.
    Path for UserDataTable = c:\jdk13~1.1\jakart~1.3a\webapps\internet\web-inf\classes\servlets\UserDataTable.java
    Path for LoginServlet = c:\jdk13~1.1\jakart~1.3a\webapps\internet\web-inf\classes\servlets\UserDataTable.java
    server.xml<?xml version="1.0" encoding="ISO-8859-1"?>
    <Server>
        <!-- You can add a "home" attribute to represent the "base" for
             all relative paths. If none is set, the TOMCAT_HOME property
             will be used, and if not set "." will be used.
             webapps/, work/ and log/ will be relative to this ( unless
             set explicitely to absolute paths ).
          -->
        <ContextManager workDir="work" >
          <!-- ==================== Global modules ==================== -->
            <LoaderInterceptor11  useApplicationLoader="true" />
            <TrustedLoader />
            <LogSetter name="tc_log" timestamps="true"
                 verbosityLevel="INFORMATION"  />
            <LogEvents enabled="false" />
            <!-- Backward compat: read the Context declarations from server.xml-->
            <ContextXmlReader config="conf/server.xml" />
            <!-- Separated Context -->
            <ContextXmlReader config="conf/apps.xml" />
            <AutoDeploy source="modules" target="modules"
                  redeploy="true" />
            <AutoWebApp dir="modules" host="DEFAULT" trusted="true"/>
            <AutoDeploy source="webapps" target="webapps" />
            <AutoWebApp dir="webapps" host="DEFAULT" />
            <PolicyLoader securityManagerClass="java.lang.SecurityManager"
                    policyFile="conf/tomcat.policy" />
            <SimpleMapper1 />
            <SessionExpirer checkInterval="60" />
            <!-- For development you can use randomClass="java.util.Random" -->
            <SessionIdGenerator randomClass="java.security.SecureRandom"
                                randomFile="/dev/urandom" />
            <!-- ========== context processing modules ========== -->
            <!-- This will be the "default" profile
                 ( all except the "global" modules can be set per context )
              -->
            <LogSetter name="servlet_log"
                 timestamps="true"
                 verbosityLevel = "INFORMATION"
                 path="logs/servlet-${yyyyMMdd}.log"
                 />
            <LogSetter  name="JASPER_LOG"
                 timestamps="true"
                 path="logs/jasper-${yyyyMMdd}.log"
                 verbosityLevel = "INFORMATION"  />
            <WebXmlReader validate="true" />
            <ErrorHandler showDebugInfo="true" />
            <WorkDirSetup cleanWorkDir="false" />
            <Jdk12Interceptor />
            <!-- Non-standard invoker, for backward compat. ( /servlet/* ) -->
            <InvokerInterceptor />
            <!-- you can add javaCompiler="jikes" -->
            <JspInterceptor keepGenerated="true"
                   largeFile="false"
                   useJspServlet="false"
                   />
            <StaticInterceptor listings="true" />
            <ReloadInterceptor fullReload="true" />
            <SimpleSessionStore maxActiveSessions="-1" />
            <AccessInterceptor />
            <CredentialsInterceptor />
            <SimpleRealm  filename="conf/users/global-users.xml" />
           <!-- UnComment the following and comment out the
                above to get a JDBC realm.
                Other options for driverName:
                  driverName="oracle.jdbc.driver.OracleDriver"
                  connectionURL="jdbc:oracle:thin:@ntserver:1521:ORCL"
                  connectionName="scott"
                  connectionPassword="tiger"
                  driverName="org.gjt.mm.mysql.Driver"
                  connectionURL="jdbc:mysql://localhost/authority"
                  connectionName="test"
                  connectionPassword="test"
                "connectionName" and "connectionPassword" are optional.
            -->
            <!--
            <JDBCRealm
                debug="99"
             driverName="sun.jdbc.odbc.JdbcOdbcDriver"
             connectionURL="jdbc:odbc:TOMCAT"
             userTable="users"
                userNameCol="user_name"
                userCredCol="user_pass"
             userRoleTable="user_roles"
                roleNameCol="role_name" />
            -->
            <LoadOnStartupInterceptor />
            <Servlet22Interceptor />
            <!-- Tag pooling support.
                 To enable the reuse of tag handlers as described in
                 the JSP spec, uncomment the following.  If your pages
                 use a lot of custom tags, you should see a nice performance
                 gain.
                 Note that placing the interceptor here will enable
                 Tag pooling for all of the web applicatitions loaded -
                 this may be a bad thing if all tags are not coded to
                 handle reuse. To enable pooling only for specific web
                 applications i.e. Contexts, place the interceptor inside of
                 the Context's definition.
                 To view information about tag usage uncomment the tag
                 LogSetter. Set verbosityLevel to DEBUG to see everytime
                 a tag is obtained and released.
            -->
            <!--
            <LogSetter  name="tag_pool_log" timestamps="true"
                path="logs/tagpool-${yyyyMMdd}.log"
                verbosityLevel="INFORMATION" />
            <TagPoolManagerInterceptor />
            -->
            <!-- Request processing -->
            <DecodeInterceptor />
            <SessionId cookiesFirst="true" noCookies="false" />
            <!-- Automatic config generation
                 Set noRoot="false" if you wish to have Tomcat try to take
                   control of the external web server's root context.
                   Additonal configuration of the external web server may be
                   required for this to be successful.
                 Note: Configuration files are not written as part of the
                   default startup behvior.  Append "jkconf" to the startup
                   command to have Tomcat initialize, write the config files,
                   then exit. This may be done while Tomcat is running.
              -->
            <ApacheConfig noRoot="true" />
            <IISConfig noRoot="true" />
            <NSConfig noRoot="true" />
             <!-- Uncoment for apache-style logs
                  Attributes: logFile, flush, format
            <AccessLogInterceptor/>
              -->
          <!-- ==================== Connectors ==================== -->
           <!-- new http adapter. Attributes:
                   secure - use SSL ( https )
                   keystore, keypass - certs for SSL
                   port
                   reportedname - Server name to send back to browser
                                  by default report Tomcat Web Server ...
                                  set an empty string to avoid sending server header
            -->
            <Http10Connector   port="8080"
                      secure="false"
                      maxThreads="100"
                      maxSpareThreads="50"
                      minSpareThreads="10" />
            <!--
                Uncomment this for SSL support. You _need_ to set up a
                server certificate if you want this to work, and you
                need JSSE. See tomcat-ssl-howto.html for more detailed
                instructions.
                1. Make the JSSE jars available to Tomcat, either by making
                   them an installed extension or by adding them to the
                   Tomcat CLASSPATH.
                2. Do: keytool -genkey -alias tomcat -keyalg RSA
                   RSA is essential to work with Netscape and IIS.
                   Use "changeit" as password. ( or add keypass attribute )
                   You don't need to sign the certificate.
             -->
            <!--
            <Http10Connector  port="8443" secure="true" />
            -->
            <!--
                 JNI connector. It assumes the library is located in
                 TOMCAT_HOME/bin/native/jni_connect.[dll, nlm, so]. or in LD_LIBRARY_PATH.
                 For different paths set "nativeLibrary" parameter.
                 The JniConnector will be self-enable only if JNI mode is detected.
             -->
            <JniConnector />
            <!-- Apache AJP12 support. This is also used to shut down tomcat.
                 Parameter "address" defines network interface this Interceptor
                 "binds" to. Add it if you want to "bind" to just "127.0.0.1".
                 address="127.0.0.1"
                 Parameter "tomcatAuthentication", controls if Tomcat honors
                 ( and uses ) auth done in HTTP Server or not, when true Tomcat does
                 not use in any way auth information provided by the HTTP Server.
                 true is the default.
                 tomcatAuthentication="false"
              -->
            <Ajp12Connector      port="8007" />
            <!-- Apache AJP13 support (mod_jk)
                 Parameter "address" defines network interface this Interceptor
                 "binds" to. Add it if you want to "bind" to just "127.0.0.1".
                 address="127.0.0.1"
                 Parameter "tomcatAuthentication", controls if Tomcat honors
                 ( and uses ) auth done in HTTP Server or not, when true Tomcat does
                 not use in any way auth information provided by the HTTP Server.
                 true is the default.
                 tomcatAuthentication="false"
              -->
            <Ajp13Connector port="8009" />
          <!--
               Context definitions can be placed here ( not recommended ) or
               in separate files. The ContextXmlReader will read all context
               definitions ( you can customize the "base" filename ).
               The default is conf/apps-[name].xml.
               See conf/apps-examples.xml and conf/apps-admin.xml 
           -->
    <Context path="/internet"
    docBase="webapps/internet"
    crossContext="true"
    debug="0"
    reloadable="true"
    trusted="false" >
    </Context>
        </ContextManager>
    </Server>The directory structure is:
    <c:\>
        <jdk13~1.1>
            <jakart~1.3a>
                <webapps>
                    <internet>
                        <jsp>
                        <web-inf>
                            <classes>
                                <servlets>
                                <beans>P/S: Actually, I would want to add c:\jdk13~1.1\jakart~1.3a\webapps into CLASSPATH, so that I can use the package as internet.web-inf.classes.servlet (instead of current version of classes.servlet).
    However, the compiler would not let me compile because it says ";" expected at web-inf (I think the hyphen is not allowed). Is there any other solution?
    Thanks and sorry to bother you again!

  • Jakarta Tomcat error - 'Package MyUtils not found in import.'

    Jakarta Tomcat - 'Package MyUtils not found in import.'
    Can anyone help with this error please?
    My JSP code P6.jsp contains :-
    <%@page import="MyUtils.* ,java.util.*"%>
    But, the package MyUtils with class file NameStore.class is not found.
    The actual error at JSP translation time is:-
    org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
    C:\jdk1.4\jakarta-tomcat-4.0.1\work\Standalone\localhost\lab06\P6$jsp.java:3: Package MyUtils not found in import.
    import MyUtils.* ;
    ^
    My directory structure is listed below:-
    %CATALINA_HOME/webapps/lab06( contains P6.jsp)/web-inf/classes/MyUtils/NameStore.class
    Can anyone help please?
    Thanks,John Withington

    put your package in your WEB-INF directory!

Maybe you are looking for