Question on classpath  and path

path=.;D:\j2sdk1.4.2_04\bin;D:\j2sdk1.4.2_04\tomcat4.1\bin
classpath=.;D:\j2sdk1.4.2_04\bin;D:\j2sdk1.4.2_04\tomcat4.1\common\lib\servlet.jar
it work well in J2SE but doesn't work well in servlet
what's wrong?

I am sorry but **
D:\javatest>javac -classpath D:\j2sdk1.4.2_04\Tomcat4.1\common\lib\servlet.jar h
ello.java
hello.java:6: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
hello.java:7: package javax.servlet does not exist
import javax.servlet.*;
^
hello.java:14: cannot resolve symbol
symbol  : class HttpServlet
location: class com.seriousJavaProject.servlets.Hello
public class Hello  extends HttpServlet {
                            ^
hello.java:16: cannot resolve symbol
symbol  : class HttpServletRequest
location: class com.seriousJavaProject.servlets.Hello
public void service(HttpServletRequest request,HttpServletResponse response) th
rows IOException ,ServletException
                     ^
hello.java:16: cannot resolve symbol
symbol  : class HttpServletResponse
location: class com.seriousJavaProject.servlets.Hello
public void service(HttpServletRequest request,HttpServletResponse response) th
rows IOException ,ServletException
                                                ^
hello.java:16: cannot resolve symbol
symbol  : class ServletException
location: class com.seriousJavaProject.servlets.Hello
public void service(HttpServletRequest request,HttpServletResponse response) th
rows IOException ,ServletException
                  ^
6 errors

Similar Messages

  • Setting Classpath and Path on Windows ME

    Hi..How do I set up the classpath and path on windows ME. Do I use DOS or run the autoexec.bat from windows directly. I have jdk1.3.1 abd my classpath and path are:
    set classpath="C:\jdk1.3.1\bin"
    set PATH=C:\windows\xxxx\;C:\jdk1.3.1\bin
    I sometimes can't compile my programs from other directories other than jdk1.3.1\bin. Why? Is there a way I can compile my program just from the C:\ directory like:
    C:\javac myprogram.java
    C:\java myprogram
    Thanks.

    If you put . in the beginning of your classpath, java always searches the folder you are currently in.
    Now to set the classpath try clicking from the startmenu:
    settings/control panel/system. Then click advanced tab and then the Enviroment variables. I'm on win2000 but I think it should be the same on ME.
    Make sure it starts with .;C:\jdk1.3.1\bin;....
    I think installing jdk puts in the essentials, but if you have certain folders you store your classes in you can stick those in there as well.
    If you hava more questions about this, I suggest searching these forums on Keywords like : "set CLASSPATH PATH". Then you'll find a bunch of threads solving this problem.
    Sjur

  • Problems in Classpath and Path 's variables setting in Windows XP

    Here is my drive structure in my PC:
    1. hard drive (primary slave, Partition: C and E where E boot Windows XP
    2. Hard drive 2 (Primary Master), Drive letter: D
    Although my default boot directory is E (for strange reason, i like to keep
    that way for now), I installed other programs in C and D drive dues drive
    space factors.
    So My java sdk1.4.2_02 has been installed in C:\Java_home directory, the
    following is my Classpath and Path values:
    (CLASSPATH Variables)
    Classpath=.;
    c:\java_home\j2sdk1.4.2_02;
    e:\Program Files\java\j2re1.4.2_02;c:\java_home; c:\java_home\j2sdk1.4.2_01
    \lib;e:\Program Files\java; e:\Program Files\java web start;c:\java_home\j2
    sdk1.4.2_02\jre\lib;c:\java_home\java\petstore1.3.2\src\lib\jst1;
    (PATH variables)
    c:\java_home\j2sdk1.4.2_01\bin;C:\java_home;e:\Pr
    ogram Files\java;c:\java_home\jdk1.4.2_2\bin;E:\Program Files\Oracle\jre\1.
    1.8\bin;E:\WINDOWS\system32;E:\WINDOWS;E:\WINDOWS\system32\WBEM;E:\
    Program Files\Support Tools\;
    PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
    Path=D:\oracle\ora92\bin;E:\Program Files\Oracle\jre\1.3.1\bin;
    My Fruit txt and Fruit.java file is located in my c:\java_home folder
    when I try to compile the my file as <c:\java_home\javadoc Fruit.java), it
    gives me the error message<'javac' is not recognized as an internal or
    external command,operable program or batch file.>
    however, I can compile the Fruit file from C:\java_home\jdk1.4.2_2
    \bin\javadoc Fruit.java; with out any problem of course I have to copy the
    Fruit.java file at the C:\java_home\jdk1.4.2_2\bin\javadoc Fruit.java
    folder.
    I am requesting u please help or advise me to correct my mistakes
    Ely
    [email protected]

    I must confess that I am totally unable to understand what your PATH is set to. The error that you see,
    <'javac' is not recognized as an internal or external command,operable program or batch file.>
    is due to a missing or incorrectly set PATH. It is used by Windows to find executable file (like javac.exe) that you have added to the computer. Item #5 on this page gives you instructions on how to set it: http://java.sun.com/j2se/1.4.2/install-windows.html
    As for the setting of the CLASSPATH, you seem to have a number of different versions of java (1.4.2_02, 1.4.2_01, 1.4.2_2, and 1.1.8) and I doubt that these are all valid. You are also using an unusual syntax C:\java_home\jdk1.4.2_2\bin\javadoc Fruit.java and I wonder if that is really C:\java_home\jdk1.4.2_2\bin\javadoc\Fruit.java? I think the best action is to point you to Sun's instructions and information about setting and using the CLASSPATH.
    The CLASSPATH is a set of pointers that is used by Java to find the files that YOU (not Java) create and want compiled and/or run.
    Setting the Classpath:
    http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/classpath.html
    [NOTE: always start your classpath with ".;" which means the current directory. See my classpath, below]
    How Classes are Found:
    http://java.sun.com/j2se/1.4.2/docs/tooldocs/findingclasses.html
    Examples:
    This is my path
    PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\BATCH;C:\J2SDK1.4.2_01\BIN;C:\PROGRA~1\UTILIT~1;C:\PROGRA~1\WIN98RK
    This is my classpath
    CLASSPATH=.;C:\mjava;C:\mnrx;C:\NetRexx\lib\NetRexxC.jar;C:\j2sdk1.4.2_01\lib\tools.jar;C:\NetRexx\NrxRedBk

  • Setting CLASSPATH and PATH properly how?

    I have set PATH=c:\jdk_install_directory\bin which works fine. However, for example when I create an app or small program for example, simply to print out a line on the screen, it works when I compile in NetBeans. However, if I copy the java file to another directory, my C: root for example, I can compile it, but when I run the class file it gives me errors saying it can't find certain classes. So, I figure its something with the classpath variable that I have to fix. How can I do this properly for both J2SE and J2EE using default install directories for each.
    Thanks so much!!

    Your PATH is exactly what it should be.
    The CLASSPATH answer depends on where you're compiling and running.
    If you're doing things on the command line, I think the right answer is to use the -classpath option on javac.exe and java.exe.
    If you're using NetBeans or another IDE, the right answer is to add JARs and paths according to the idiom demanded by the IDE. Each one is different, and all the ones I know of ignore the system CLASSPATH environment variable. I don't have one set on my machine.

  • Classpath and path of jdkjdk-1_5_0_09

    hi
    i have installed c:\progrmaefiles\java\ jdk-1_5_0_09 on my pc but i m not able set systemenvironment variable like PATH and CLASSPATH .i tried lot of option but it does not work so plz anyone help me out.i m using windows Xp operating system. when i m running any java programe i m getting error " Exception in thread "main" java.lang.NoClass.DefFoundError.plz hep me out.
    thx manu

    That's CLASSPATH, not PATH.
    Without seeing your exact directory structure and the exact command you're runing, nobody can give you specific advice. Here are some explanations of how it works, though.
    Javapedia: Classpath
    How Classes are Found
    Setting the class path (Windows)
    Setting the class path (Solaris/Linux)
    Understanding the Java ClassLoader
    java -cp .;<any other directories or jars> YourClassNameYou get a NoClassDefFoundError message because the JVM (Java Virtual Machine) can't find your class. The way to remedy this is to ensure that your class is included in the classpath. The example assumes that you are in the same directory as the class you're trying to run.
    javac -classpath .;<any additional jar files or directories> YourClassName.javaYou get a "cannot resolve symbol" message because the compiler can't find your class. The way to remedy this is to ensure that your class is included in the classpath. The example assumes that you are in the same directory as the class you're trying to run.

  • Post jDev 903 cleanup: Classpath and Path.

    Having installed the new [complete set] 9.0.3 and having decided NOT use 9.0.2 or other developer suite tools, it's time to clean up my path and classpath settings.
    Please help me sort it all out. Thanks.
    Per instructions I did not install the new 9.0.3 into any existing oracle_home. The home_dir for the 9.0.2 and complete suite is: E:\Programs\OraDevSuite.
    My Classpath has three entries: (formatted for easy reading on the forum.)
    CLASSPATH=
    E:\Programs\OraDevSuite\jlib\bigraphbean.jar;
    E:\Programs\OraDevSuite\jlib\LW_PfjBean.jar;
    E:\Programs\OraDevSuite\jlib\bigraphbean-nls.zip
    Questions: 1. Can (Should) I throw these out? 2. Do I need anything else in the classpath? (The java command line uses the -classpath parameter anyhow.)
    Here are the PATH settings (in the order maintained by the os). This really needs to be cleaned up. I have added my question on each line. Sounds like alot of questions but many are the same type.
    Path=
    E:\Programs\OraDevSuite\bin; (Old suite: Good-bye?)
    E:\Programs\OraDevSuite\jdk\jre\bin; (Old suite: Good-bye?)
    E:\Programs\OraDevSuite\jdk\jre\bin\classic; (Old suite: Good-bye?)
    E:\Programs\OraDevSuite\jdk\jre\bin\classic; (Old suite: Good-bye?)
    E:\Programs\OraDevSuite\jlib; (Old suite: Good-bye?)
    E:\Programs\OraDevSuite\bin; (Old suite: Good-bye?)
    E:\ORACLE\bin; ( How do I verify if this is needed by 9iDB or OEM?)
    C:\Program Files\Oracle\jre\1.3.1\bin; ( Since 9.0.3 comes with its own can I REMOVE this FROM THE DISK? )
    C:\Program Files\Oracle\jre\1.1.8\bin; ( Can I remove this from the disk? )
    C:\WINDOWS\system32;
    C:\WINDOWS;
    C:\My Programs\Java\sdk1_3\bin; ( Can I remove this from my disk? )
    **********THANK YOU!**************
    -Nat

    If you downloaded the full version of 9.0.3 Dev Preview (the 160MB sized-one), then it's completely self-contained. Just unzip it and go. Anything else can be removed.
    If you downloaded the "base" version, then you'll need to keep a JDK 1.3 around and edit your .\jdev\bin\jdev.conf file to SetJavaHome to point at your JDK home location.

  • How to set the classpath and path from the jsp to call  java class function

    Hi Exprets,
    I have a requirement to call a java class function which returns a hashmap object from the jsp. The java class in present in one jar file and that jar file is location somewhere in unix path. So the requirement is to set the classpath for that jar file and then create the object of the java class and then call the function.
    If any one know how to achieve it, please reply as soon as possible.
    thanks in advance,
    swapna soni.

    It is never advisable to store large data sets in the session. But it will depend on a lot of factors:
    1. How costly is the query retrieving the data from the database?
    If it's a complex query with lots of joins and stuff, then it will be better to store it in the session as processing the query each time will take a lot of time and will decrease performance. On the other hand if the query is simple then it's advisable not to store it in the session, and fetch it each time.
    2. Are there chances for the data to become stale within a session?
    In this case storing the data is session will mean holding the stale data till the user session lasts which is not right.
    3. How many data sets does the session already holds?
    If there are large no. of data sets already present in the session, then it's strictly not advisable to store the data in the session.
    4. Does the server employ some kind of caching mechanism?
    Using session cache can definitely improve performance.
    You will have to figure out, what is the best way analyzing all the factors and which would be best in the situation. As per my knowledge, session is the only place where session specific data can be stored.
    Also, another thing, if the data set retrieved is some kind of data to be displayed in reports, then it would be better to use a pagination query, which will retrieve only the specific no. of rows at a time. A navigation provided in the UI will retrieve the next/previous data set to display.
    Thanks,
    Shakti

  • Problem in setting CLASSPATH and PATH

    I am a newbie in java. I downloaded and run the "j2eesdk-1_4_01-windows.exe" from Internet. By default, it creates a new user variable, which is "PATH = C:\Sun\AppServer\bin". My problem is when I try to compile a java, I get an error message, which is
    'javac' is not recognized as an internal or external command,
    operable program or batch file.
    I create a new user variable which is "CLASSPATH = .;C:\Sun\AppServer\jdk\bin"
    and add new variable into my system variable, which is
    "PATH = %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Sun\AppServer\jdk\lib"
    However, it doesn't work and give the same error message. Any idea about the solution?
    Thanks in advanced.

    Your PATH variable needs to include the path to the J2SE SDK bin directory. It looks like you added it to your CLASSPATH instead

  • A question about CLASSPATH and Package

    The configuration of my computer is:
    Windows98, C:\j2sdk1.4.0
    Which in Autoexec.bat are included like this:
    path=C:\j2sdk1.4.0\bin
    set CLASSPATH=C:\j2sdk1.4.0\lib
    Then I make a new directory named t in C:\j2sdk1.4.0\lib, where there is a compiled file a.class, source code is:
    package t;
    public class a
    And another java file was in D:\t, named b.java, code like this:
    import t.*;
    class b extends a
    public static void main( String[] args )
    System.out.println("OK");
    Then I compiled like this: javac b.java, it was wrong; but when I compiled like this: javac -CLASSPATH C:\j2sdk1.4.0\lib b.java, It was OK!!! Why?? And then when I execute like this: java b, an error message was prompted(Can not find class t/a)!!! How can I do?

    First one general comment: I would not advise putting your own classes into C:\j2sdk1.4.0\lib since this suggests that the classes under this directory belong to the Java distribution. So my advice: create your own directory somewhere like D:\user\Classes or whatever.
    The directory (-ies) you specify in CLASSPATH are root entries telling the JVM where to start looking for classes. Why root entries? Well, the package structure is reflected in the directory structure relative to these roots. So a class of package t belongs into the subdirectory t of one of the directories specified in your CLASSPATH. This would be the case of your class a - by the way, the convention says that class names are capitalized. Since class b, on the other hand, is not in any package, it belongs irirectly into one of the directories of your CLASSPATH.
    Whereas the compiler is fairly forgiving about the location of your source files, the JVM is not. Invoking a class of some package requires you to provide the fully-qualified name to the java command. So if you wanted to run class a, you would have to invoke "java t.a". Starting class b, simply requires a call of "java b". But make sure the class file of class a is located in the subdirectory t of one of the directories specified in your CLASSPATH.

  • Question about classpath and jar file

    I have a jar file (actually jhall.jar, the java help jar file). How do I uses its classes if I don't want to add it to the classpath. Currently, I have the jar file in the same directory as all my other classes.

    it simply adds secondjar.jar into firstjar.jar, rather
    than extracting secondjar.jar's files and put it into
    firstjar.jar. How would I be able to do that?Don't do either of them. Distribute the two jar files separately, and in the manifest of the one which is meant to be your executable jar file, put a Class-Path: entry that refers to the other one. Look at the latter parts of the tutorial about jar files:
    http://java.sun.com/docs/books/tutorial/jar/basics/
    PC&#178;

  • Classpath and Path in Win2k Server

    Hi
    My OS is windows 2000 Server
    I installed Jdk 1.3.x Version.
    Do I need to set path and class path to my system to run sql package files...
    What shalll i include in my path and in class path.
    If any one having idea, please help me.
    Thanks in advance
    Yours
    Rajesh

    Dear dewangs,
    Thankyou VeryMuch
    Do I have to keep tools.jar file in my path or else in my class path ?
    Thanks in advance
    Yours
    Rajesh

  • Question about CLASSPATH Prefix and others...

    Hi all,
    Would someone pls give me some help about the following questions:
    1. how to set the CLASSPATH Prefix, CLASSPATH and SERVERCLASSPATH, and
    the usage of them?
    2. the default JAVA_HOME is \WebLogic\jre1_2, after I changed it to
    \jdk1.1.7, the EJB Deployer failed to start with error message: The
    windows registry is misconfigured for Weblogic Server. Even after I
    copy jre under \WebLogic\jre1_2 to \jdk1.1.7
    3. For testing purpose, I changed weblogic.class.path back, then
    restarted NT, started Weblogic Server, to my surprise, the pool was
    created as well! How do you think about this?
    Thanks in advance,
    Paul Shen
    Email: [email protected]
    WWW: shensr.8m.com

    WLS loads classes from weblogic.class.path property
    Refer this document
    http://www.weblogic.com/docs51/admindocs/classpath.html
    Kumar
    Paul Shen wrote:
    At first, thanks Jesse for the help. Sorry for my mistake that making
    question 3 out of context.
    WinNT 4.0 SP6, Weblogic 5.10, SQLServer 7.0
    I wanna create a connection pool for SQLServer. At beginning, I
    mis-add the JDBC Driver class path to weblogic.class.path. As a result
    the pool creating failed. After I add the JDBC Driver class path to
    weblogic.class.path and CLASSPATH (by wlconfig), the pool created
    succefully.
    For testing purpose, I changed weblogic.class.path back, then
    restarted NT, started Weblogic Server, to my surprise, the pool was
    created as well! How do you think about this?
    Paul
    On 22 Aug 2000 12:27:28 -0800, [email protected] (Jesse E Tilly)
    wrote:
    Comments inline...
    [email protected] (Paul Shen) wrote in <wS2iOZDX8dSgABq4nblptb+wg7Uz@
    4ax.com>:
    3. For testing purpose, I changed weblogic.class.path back, then
    restarted NT, started Weblogic Server, to my surprise, the pool was
    created as well! How do you think about this?This question seems out of context. I do not know what pool you are
    referring to, nor the actions prior to changing the classpath.
    Jesse

  • Question about pass file name and path to file write adapter

    I need to pass file name and path to file adapter for write. I got partial answers from thread Re: Get File name using File Adapter , but seems InboundHeader_msg or outboundHeader_msg only takes file name, how do I pass file directory?
    since I still have to specify file format (like xxx_%xx%.txt) in the file adapter wizard. Will this name conflict with what the name defined in InboundHeader_msg ?
    Similarly, how can I pass a file name and path to a file synchread adapter?
    Thanks,
    Message was edited by:
    user531689

    Just overwrite the filename in the WSDL file that was generated

  • Classpath and manifest.mf

    what is the difference between classpath, buildpath and a Manifest.mf paths?
    I believe class path is used at run time to look for the classes referred in this path.
    Build path is used to build the application i.e. to link the components used while compiling and building classes.
    Manifest.MF is also used for runtime resolution.
    What different purpose did classpath and manifest.mf serve?

    If I understand you correctly, this is more of a general Java Question then a Java Servlet Question... but anyway...
    The manifest.mf is defined for JARs. Your system CLASSPATH, and the classpath set on the command line are ignored for JARs, and only the CLASSPATH set in the manifest is used.
    When running applications outside of JARs, then the system/command line CLASSPATH is used.
    When running a web application inside a WAR, the server has its own classpath which will override that of the manifest and the system CLASSPATH.

  • I want to *use* very long file and path names!

    This is really a plea to Microsoft...
    There are several threads about copying or deleting files where the path and/or file name is too long.
    Most have explanations of why this problem occurs.  (depending on Windows version and application, the total length [fully qualified file name; i.e. C:\this-dir\that-dir\somefile.xyz] is limited to a maximum of 260 or fewer characters).  This limit
    But I *WANT* to be able to use very long file names and paths!
    I can understand Microsoft keeping this limit - even while allowing UNICODE paths and file names up to 32k characters - because many existing tools will be unable to handle the longer names.  This would probably yield a lot of questions/flames about
    them "breaking the software I've used for years."
    But it would be possible to have a system setting to optionally allow the long names.  Since I'd have to manually set it, I'd know I'm potentially breaking existing software.
    In my case, I'm backing up various file directories where some files are very long.  With the server-side additional paths (e.g., client-name\project-name\backup-date\...") I occasionally hit files that can't be copied.  Renaming is not suitable;
    sometimes names have to match other file names.
    I can zip them, create iso files, use a backup program that creates a blob, put them in a source-control system, etc - but I really don't *want* to do that; it's very convenient to have a direct copy of the directories.  Each of these 'solutions' either
    requires extra work (which could be scripted, so ok...) or doesn't work with the work-flow for some reason.
    Microsoft, *please* fix this in Windows 8!  (if not before...)   This limit has existed for far too long!
    And readers - please don't just repeat what's in the other threads (rename/use subst/map directory/etc) or flame without useful information.  Thanks!

    Hi,
    I would submit your opinion to our Product Team. If you have another feedback, please feel free and let me know. Or you could follow TekDozer’s advice to submit
    by yourself.
    Thank you for your understanding and cooperation.
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”

Maybe you are looking for