Setting classpath variable

How shld i set class path variable?
Pls help

It doesn't work when you have multiple applications which needs different versions of the same classfile(s). E.g. Lets say that you have two applications that try to connect to a database. One requires a driver for oralce 8, and jdk 1.3, and the other requires a driver for oracle 9, and jdk 1.4. What do you do?
/Kaj

Similar Messages

  • Novice Trying to Set The CLASSPATH Variable

    I am trying to compile a file (which can be downloaded at http://java.sun.com/docs/books/tutorial/getStarted/QandE/FirstClass.java). Despite being able to successfully compile several other files, this particular one will not compile. According to my JAVA Tutorial book, the problem may lie in the CLASSPATH variable, but I am having a great deal of trouble trying to set/understand it. My operating system is WINDOWS 2000. PLEASE HELP!!!

    in win 2000, the classpath can be set by the following process.
    Right Click My Computer icon and click on properties.
    (This can be done by going to the Control Panel and Double Clicking the System icon too).
    Once you have the properties window of the system click on the 'Advanced' tab.
    There is a button called 'Environment variables'.Click on it.
    You will have a part called 'System Variables' there.
    Here there is an entry called Classpath. Just add the entry of what you want to add to the classpath, separating each entry with a ';' semicolon as mentioned there and click on the Set button.
    That should set the classpath.If that does not take effect immediately, restart the system and it will take effect.
    Tell me if it worx.
    All the best. Bye!
    Cheers,
    Win!

  • Setting my Classpath variable

    Hi
    Could someone please help me get the classpath variable working
    C:\Java\sampledir\Java Game Programming;.;C:\Program Files\s1studio_jdk\j2sdk1.4.1_02\lib\tools.jar
    This is what I have in the Classpath variable now in my Windows 2000 O/S
    Now from what I gather with having this set up in the classpath I should be able to compile anything in the Java Game Programming Folder and I can do it right from the C:\ prompt. Am I correct in thinking this?? or do I need to be in the directory with the file I want to compile??
    The error message I recieve after typing from the C:\ prompt javac GameOver.java
    produces this error message
    error: cannot read: GameOver.java
    1 error
    Now I do know everything within the file is correct because it compiles and runs successfully in Sun One Studio. :)
    Thank you
    Scott

    The classpath is a way for the compiler to resolve class names it encounters in the source files.
    But you still have to give it the exact path to your source file !
    you don't need to be in the directory of the file, you can just give its absolute path from whatever directory you happen to be.

  • Error in setting environment variable

    hi
    Please note JKit is where my jdk1.3 is stored(i.e instead of jdk1.3 folder its JKit folder)... i have gone thru the similar threads but with no success.
    SET
    PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;D:\Jkit\bin;D:\Jkit\lib;D:\Oracle\bin;"C:\PROGRAMFILES\ORACLE\JRE\1.1.7\BIN";D:\JKit\Jre\Bin;
    SET PATH=%PATH%;C:\PROGRA~1\COMMON~1\AUTODE~1;
    SET CLASSPATH=c:\JavaWebServer2.0\lib\servlet.jar;c:\JKit\lib;
    SET CATALINA_HOME=D:\tomcat\jakarta-tomcat-4.1.29;
    SET JAVA_HOME=D:\Jkit;
    The error i get after running autoexec.bat and then tomcat/bin/startup is as follows..
    The CATALINA_HOME environment variable is not defined
    This environment variable is needed to run this program
    please HELP!!.THANKS

    Hi
    Very many thanks for ur solution.. i actually hadset the environment variables spacce..but when i execute the autoexec.bat file i dont get any error(out of env space)..but when i run the startup.bat file i get from the command prompt, i get the foll error.
    This is my Autoexec.bat
    SET JAVA_HOME=D:\Jkit\bin
    SET CATALINA_HOME=D:\tomcat\jakarta-tomcat-4.1.29\bin
    SET PATH=D:\Jkit\bin;C:\WINDOWS;C:\WINDOWS\COMMAND;
    SET PATH=%PATH%;C:\PROGRA~1\COMMON~1\AUTODE~1;
    THE FOLLOWING IS THE ERROR I GET WHEN I RUN STARTUP.BAT UNDER TOMCAT'S BIN UNDER THE COMMAND PROMPT
    D:\tomcat\jakarta-tomcat-4.1.29\bin>startup
    Syntax error
    Out of environment space
    Out of environment space
    Out of environment space
    Using CATALINA_BASE: D:\tomcat\jakarta-tomcat-4.1.29
    Using CATALINA_HOME: D:\tomcat\jakarta-tomcat-4.1.29
    Using CATALINA_TMPDIR: D:\tomcat\jakarta-tomcat-4.1.29\temp
    Using JAVA_HOME: D:\Jkit
    Out of environment space
    Out of environment space
    Invalid switch - -DJAVA.ENDORSED.DIRS=D:\TOMCAT\JAKARTA-TOMCAT-4.1.29\COMMON\ENDORSED
    I even set JAVA_HOME AND CATALINE_HOME to the \bin dir respectively..
    still i get the same error
    As given under the tomcat installation documentation (RUNNING.txt), i set the space for environment space under the Memory tab, for startup and shutdown.bat files, it creates a shortcut for running the resp .bat files, running startup.bat file i get,CATALINA_HOME VAR HAS NOT BEEN SET PROPERLY, THIS OCCURS FOR BOTH TOP LEVEL DIR SETTING AND /bin DIR SETTING of CATALINE_HOME IN autoexec.bat
    PLEASE HEL, I HAVE BEEN TRYING TO CONFIGURE IT FOR THE PAST DAYS BUT WITH NO SUCCESS, DONT KNOW WHERE I AM GOING WRONG..PLEASE HELP

  • Setting Path variable in Win XP Pro

    Hello,
    I have installed Java SDK 1.3.0_02 on Windows XP professional.
    I have set my path to:
    %SystemRoot%\system32; %SystemRoot%; %SystemRoot%\system32\WBEM;
    %SystemRoot%; %SystemRoot%\system32\WBEM; C:\Program Files\Common
    Files\Adaptec Shared\System; %Java_Home%\bin; %Java_Home%; %Tomcat_Home%;
    where %JAVA_HOME% refers to C:\jdk1.3.0_02.
    I get the following error upon trying to use 'javac' in the DOS command
    prompt:
    'javac' is not recognized as an internal or external command, operable
    program or batch file
    According to the instructions at
    <http://java.sun.com/j2se/1.3/install-windows.html#Environment> I have done
    all I can. Also, according to this article I should not have to set a
    classpath variable. Should I set a classpath variable?
    Here are some conditions I cannot figure out:
    1) When I use the 'java' command with any switches (such as -version) I get
    a proper response.
    2) When I type on the command line "set path=C:\jdk1.3.0_02" and then try
    "javac" command it works. This happens only while the command window is
    opened. If it is closed and reopened I will have to do it again. This should
    not be required.
    3) When I navigate to the "C:\jdk1.3.0_02\bin" directory and try using the
    "javac" command it works fine.
    4) Everytime I use the 'autoexec' command in the C: root directory I get an
    old version of the path variable without my recent path settings.
    What do I need to do to simply open a command prompt and compile Java code?
    It seems to work fine on other installations. I want to be able to use
    'javac' from any directory without referencing in the command line the
    directory of 'javac'.
    My main question is how do I set the path variable so it permanently stays in
    Windows XP Pro? What is the simplist way to do this?
    Should it be set in the environmental variables section under 'My Computer'? Should it be set in DOS? Should it be set in 'autoexec.syd' in the C: root directory (there is not autoexec.bat)? Someone mentioned to set the
    Sincerley,
    Chris

    From the command prompt echo your classpath (echo %classpath%) and see what displays. If it's not the one from your environment variables, then something else is getting it's dirty hands in the way.
    You may want to take a look through your autoexec.bat and remove any lines that set the path variable. Leave it to your windows environment settings to do it for you.

  • Trouble Setting Classpath on Windows XP

    I'm having trouble setting up a classpath on Windows XP for SDK1.3.1_04.
    I've tried Control Panel\Advanced\Environment Variables\System Variables. There was a Path variable present, to which I've added:
    c:\jdk1.3.1_04\bin;
    There wasn't a Classpath variable present though. I've tried adding it myself in System Variables as follows:
    Variable name: Classpath
    Variable value: set classpath=.;
    But no joy. When I run "set" from the command prompt, there's no classpath present.
    I'd appreciate any help.
    Cheers.

    Hi,
    I am running on XP (unfortunately), but also win2000 and win98.
    Setting up the classpath is not a problem, although if you are logged in as root, then it does not always show correctly.
    Try logging back in as yourself and then checking the classpah through the set command.
    Altrnatively, if this is not the problem, actualy try a reboot. which should not be necessary.
    best
    kev

  • Problems in setting classpath in vista

    i am using Xp pro and Vista.
    My issue is that I am not able to set classpath in vista.
    i want to set classpath so that I can compile and run programs from different folder other than default one in which java is installed.
    Please help.

    i am using Xp pro and Vista.
    My issue is that I am not able to set classpath in
    vista.
    Don't worry about it. The CLASSPATH variable is best avoided anyway. Specify classpaths for particular apps on the command-line. Teh Docs show you how
    i want to set classpath so that I can compile and run
    programs from different folder other than default one
    in which java is installed.
    Please help.This suggests you're talking about PATH rather than classpath. Do you understand the difference?

  • Setting Classpath in linux

    Hi !! Can anyone help me in setting classpath in linux to run servlets/? I tried using this command..but didnt work
    export CLASSPATH="$CLASSPATH:/usr/share/tomcat5/server/lib/servlets-common.jar"
    Thanks
    Nive

    in ur autoexec.bat file write the following
    set PATH=C:\jdk1.5.0_04\bin;%PATH%
    set JAVA_HOME=C:\jdk1.5.0_04
    set
    CLASSPATH=.;C:\jakarta-tomcat-5.5.9\common\lib\servlet
    -api.jar;C:\jakarta-tomcat-5.5.9\common\lib\jsp-api.ja
    r;C:\Servlets+JSP;..;..\..;C:\jakarta-struts-1.2.4\lib
    \struts.jarThis response is meaningless. Principally because the OP specifically mentioned the use of LINUX. Not Windows.
    I've taken the advice of other forum users by avoiding a system level classpath variable. I define the classpath each time I compile and run. Working on Linux I tend to use command line argument files ( http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/javac.html#commandlineargfile ) which eliminates the need to redefine the classpath each time I compile or run my classes and apps. But others may do things differently.
    Here is a website you might want to check out which pertains to setting the classpath on Solaris and Linux.
    http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/classpath.html

  • How can i figuere out my classpath variable

    the tutorial is saying that i need to create and appropriate class path. i know wer to go to set it but what should i set it to. if that makes any sense. you see im trying to run the hello world program and ive tryed everything but setting the classpath variable so that the os will know were to go to look for the information but i dont really know what state the path is in and i dont know what to set it to. id greatly appreciate the support.

    Open a Command Prompt window and type "echo %CLASSPATH%" on windows or "echo $CLASSPATH" on unix.
    That will show you your existing CLASSPATH.
    Mine looks like this:
    .;C:\program files\j2sdk1.4.2_02\jre\lib\rt.jar
    The Classpath contains all the jars and class folders that your program needs separated by ; (windows) and : (unix). So if your classes are in the folder: myapp\classes, then add
    ;myapp\classes
    to the end of your classpath.

  • 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.

  • Setting Classpath on Windows 2000 box

    I have written a java application that is deployed to a Windows 2000 box. This application requires that a number of .jar files be included in the classpath, but it appears Windows 2000 imposes a maximum character length on the classpath variable because when I try to include all my .jar files in the classpath variable, the string is getting cut-off after a set number of characters. For example, I would like my classpath set to c:\classes\jar1.jar;c:\classes\jar2.jar;c:\classes\jar3.jar, but Windows 2000 only recognizes c:\classes\jar1.jar;c:\classes\jar2.jar;c:\cl. This causes my application to take java.lang.NoClassDefFoundExceptions since all the .jar files do not get included in the classpath.
    Does anybody know of a way around this issue? I would really like to avoid extracting the contents of my .jar files to a directory structure. Thanks for your help.

    I forget what the limits in Windows are, but they're a lot bigger than the size you need. I just set my classpath to that string in Windows 2000 with no problem. I believe Windows has a limit on the total size of the environment: maybe you have a whole lot of other environment variables set that you could dump. More likely, the problem has nothing to do with a Windows size limit, and you're getting cut off somewhere else.

  • Setting Classpath on windows platform

    Hello
    I was trying to set classpath of "D:\documentum\config" in my environment variable , i was doing it through command
    prompt , the command i was implementing was
    set classpath=D:\documentum\config;
    but the when i was closing command prompt , the environment variable in windows named as ClassPath was not updating
    i have also tried this command
    set classpath=%classpath%;D:\documentum\config;
    this also having the same result , so how can i set this property through command prompt
    Regards

    You can permanently set command line environmental variables through the advanced settings in Windows. You have to hunt around for it a bit, it is somewhere behind opening the right click properties of "my computer" (or whatever it is called in your flavor of Windows) and then choosing advanced. An "environmental variables" tab should be present there.
    BUT! I would not advise you to set a classpath variable unless you fully realize that is only to make your development life a bit easier when working on the command prompt. When making your application ready for deployment the classpath must be managed without the variable. A script could work, or packaging everything up as an executable jar. When you start to work with an IDE like Eclipse or Netbeans you don't need that variable at all any more.

  • Setting classpath permanantly on linux

    Helloa folks;
    My serach through the archive didn't turn up any answer to this. I am trying to set the classpath variable permanantly on Linux (SuSe). I have been using "export JDK_HOME=YadaYada", but this doesn't live on between sessions and re-boots. How does one permamantly configure this environment variable for all users including root on a linux bo so that it lives on between sessions and re-boots?
    TIA, Will-

    Please, don't cross post! Check answer in
    http://forum.java.sun.com/thread.jsp?thread=185668&forum=31&message=594195

  • Setting classpath and creating packages

    Hi
    I am new to Java and my questions are basic.
    1)I am using the kawa IDE and i dont know how to create and use packages.
    2)Creating classpath to compile and run java programs from the Dos prompt.
    I would appreciate any help on these questions

    I'm not sure how to use KAWA.
    When it comes to classpaths, though, I would recommend not setting it as an environment variable - this tends to cause confusion if you work on more than one project at a time on your machine. Either set it locally or specify it directly on the command line.
    Often it's a good idea to write a batch file for compiling and executing your code:
    setlocal
    set PATH=c:\j2sdk-1.3
    set CLASSPATH=c:\jars\Servlet.jar
    javac MyClass.java
    endlocalHope this helps.

  • Classpath variable

    Can someone please help me with what exactly the classpath variable does? I have my java and javac.exe files located in C:\Program Files\Java\jdk1.5.0\bin. I can only compile and run files that are located in this directory. So if I put my HelloWorld.java file in that directory and run the compiler, it does create a HelloWorld.class file in that directory too. When I run the file using java HelloWorld the program runs fine.
    How can I save the files in other directories but still compile and run them? Any help would be great.
    Thanks.

    classpath variable is where u specify a path with files and such in it.
    Ie \Java\jdk1.5.0\bin has got files like javac.exe and such which can normally only be run from that folder but if u specify that folder as a classpath variable it means that u can run the file javac.exe from anywhere in the computer.
    To do this I have created a batch file I run every time.
    part of it is:
    set JAVA_HOME=C:\j2sdk1.4.2_05
    (no need to specify the bin folder I think)
    if u have something like XP look at system in the control panel under a button called environmental variables and add in that path
    Regards, Rory

Maybe you are looking for

  • Upgrading from an older version of Photoshop

    I was once told by someone on the Internet who was selling Photoshop that the version he was selling could not be upgraded.  He said it was an OEM version.  Is there such a thing as an OEM version of Photoshop, or a version that is not upgradable?  I

  • Blank pictures on the previews Whats up

    Hi I have read some the posts on this issue with other people and I thought I had understood them but maybe not. I have the same problem as some of you I cannot see me previews of pictures when I download off of my card from my camera or my printer.

  • Panasonic Plasma TV does not recognize MBP

    When I connect my MBP using HDMI to DVI to the TV, the MBP recognizes the Panasonic as an external display, but it seems the TV does not recognize the MBP. Same problem with PC connection as well. Can anyone help with other settings or is there a com

  • ALE: FM 'MASTER_IDOC_DISTRIBUTE' without receiver

    Hi all, I am trying to use the FM 'MASTER_IDOC_DISTRIBUTE' without passing the receiver in the comm control structure. I've read somwhere that it's possible but I have no idea how to do this. I read that the ALE layer determines the receipient. Any h

  • Sorting options for movie collection on Apple TV (Gen 3)

    Hello, I am wondering if there are any options for sorting my movie collection other than alphabetical? It would be really nice if I could sort by "Recently Added" so it would be easy to browse through my newest movies, but I'm not sure this is possi