Path and classpath

How do i set path and classpath in java? why it is needed

ramyabaskar wrote:
How do i set path and classpath in java? why it is neededTypically you do not set these in java.
You set the path in the operating system shell.
You set path so you can launch java by just typing java
instead of having to type the full path to "C:\Program Files\Java\jre6\bin\java.exe".
You pass the desired classpath to java when you launch java with the classpath option or set it in the operating system shell using the CLASSPATH env.var.

Similar Messages

  • Difference between path and classpath

    Difference between path and classpath?

    PATH - set of paths there executables will be found.
    CLASSPATH - set of paths and archives there class files will be found.

  • Set path and classpath in ANT

    by using ANT, how can set the JDK path and classpath..
    jdk version exists in the : C:\Program Files\Java\jdk1.6.0
    This is the build.xml that i need to modify!
    -Do i need to have a serperate JAVA_HOME variable?
    <?xml version="1.0"?>
    <!--
    Build file for 'Chat Client'
    Version: $Revision: 4.10 $ $Date: 2003/05/28 $
    Author:  Rajat Gupta
    -->
    <project name="Chat" default="jar" basedir=".">
       <!-- ================================================================== -->
       <!-- Initialization of all property settings                            -->
       <!-- ================================================================== -->
       <target name="init">
          <property name="appname"        value="chat"   />
          <property name="src.dir"        value="src"               />
          <property name="lib.dir"        value="lib"              />
          <property name="build.dir"      value="Chat"            />
          <property name="build.compiler" value="classic"          />
       </target>
       <!-- ================================================================== -->
       <!-- Makes sure the needed directory structure is in place              -->
       <!-- ================================================================== -->
       <target name="prepare" depends="init">
          <mkdir dir="${lib.dir}" />
          <mkdir dir="${lib.dir}/META-INF" />
          <mkdir dir="${build.dir}" />
       </target>
       <!-- ================================================================== -->
       <!-- Compilation of the web part of the application                     -->
       <!-- ================================================================== -->
       <target name="classes" depends="prepare">
          <javac srcdir="${src.dir}/oracle/otnsamples/oc4jjms"
                 destdir="${lib.dir}"
                 includes="**" />
       </target>
       <!-- ================================================================== -->
       <!-- Compilation of the complete J2EE application (both web and EJB)    -->
       <!-- ================================================================== -->
       <target name="j2ee-meta-inf" depends="classes, prepare">
          <copy file="${src.dir}/META-INF/application-client.xml"
                tofile="${lib.dir}/META-INF/application-client.xml" />
          <copy file="${src.dir}/images/oralogo.gif"
                tofile="${lib.dir}/oralogo.gif" />
       </target>
       <target name="jar" depends="j2ee-meta-inf">
       <jar jarfile="${build.dir}/${appname}.jar"
           basedir="${lib.dir}" manifest="${src.dir}/META-INF/MANIFEST.MF"/>
          <delete dir="${lib.dir}" />
       </target>
    </project>Message was edited by:
    jugp

    [url ='http://www.jguru.com/forums/home.jsp?topic=Ant']answer here

  • How to go about Setting PATH and CLASSPATH?

    I have problems compling the helloworldwww in the core programming.the error was:
    Exception in thread "main"java.lang.NoSuchMethodError:main
    my java programs are in c:\program files\java\bin
    My path :
    PATH=C:\WINNT\system32;C:\WINNT;c:\program files\java\bin
    My classpath
    set CLASSPATH=C:\WINNT\system32;C:\WINNT;c:\program files\java\bin.jar;.
    is there any error in my paths, if yes how to i go about setting the path and classpath??Im running on winXP.j2sdk1.4.1_02.

    set CLASSPATH=.;c:\program files\java\bin.jar;c:\program files\java\bin

  • Problem in setting path and classpath for java in RedHat linux 9

    Hi ,
    i am not able to set the PATH and CLASSPATH for j2sdk1.4.2_06
    I have tried with export PATH=$PATH:/usr/j2sdk1.4.2_06/bin
    and export CLASSPATH=$CLASSPATH:/usr/j2sdk1.4.2_06/lib
    in terminal
    but i want to configure it as permenant way for the jre and jdk
    and we should only type java or javac according to the requirement
    regards mihir...

    type those in .bashrc ... save and exit
    then at prompt, type 'source .bashrc'
    this is the permanent solution ...
    bhalo thakun

  • Setting PATH and CLASSPATH in Java Applet

    Hi,
    I have been wondering if there was a way to set the PATH and the CLASSPATH in the HTML file within the <APPLET> tag...
    What I would like to do is to read some xml files outside of the directory where my html file is located to run my test application with the configuration on my computer.
    (The applet and the html file from which it is called is on my local host.)
    Therefore, I have seen that in order to access local files, I have to sign my jar files, which I did.
    But the tricky part is that for my test application to work, I need to set the PATH and the CLASSPATH... and I have no idea if this is possible or not...
    I have seen that:
    *CODEBASE: I specify here the main directory where my jar files are located
    *ARCHIVE: I specify here the list of my jar files
    In my case:
    CODEBASE=../../   (this is the root directory of my whole application)
    ARCHIVE=dir/lib/jar1.jar,dir2/jar2.jar,configXML/,etc...I don't know if I can specify the filepath of my xml files (here "configXML") in ARCHIVE (I suspect we can only specify jar files there... right ?)
    Maybe I can use ARCHIVE this way to specify my CLASSPATH (and well... not completely the way I would like I suppose), but what about the PATH ?
    I have been searching this for soooo long now...
    Any help, hint or suggestions (I might doing this all the wrong way...) would be greatly appreciated !
    Thanks in advance !

    You need to use the code attribute to specify the class that contains the main method to start the application.
    <applet code="myPackage.myClass.class" codeBase="http://www.someServer/someFolder/" archive="myApplet.jar">
    I hope this solves part of your problem at least.
    Andrew

  • Setting Path and Classpath in Linux environnement

    Hello,
    I use to develop with JAVA under Windows platform,
    now i am using j2sdk under Mandrake 8.0 , i dunno how to set my PATH end Classpath variables, could you show me how?
    Thanks

    Put this in your user's .bashrc file at the end of it.
    JAVA_HOME=/path/to/java/install
    PATH=$PATH:$JAVA_HOME/bin
    export JAVA_HOME PATHAnd buy a book on Unix/Linux.

  • About path and classpath in linux

    How to set classpath and path in Linux.
    thank you very much!

    The class path can be set using either the -classpath option when calling an SDK tool (the preferred method) or by setting the CLASSPATH environment variable. The -classpath option is preferred because you can set it individually for each application without affecting other applications and without other applications modifying its value.
    % sdkTool -classpath path1:path2...
    -or-
    % setenv CLASSPATH path1:path2...
    where:
    sdkTool
    A command-line tool, such as java, javac, or javadoc. For a listing, see SDK Tools.
    path1:path2
    Paths to the .jar, .zip or .class files. Each path should end with a filename or directory depending on what you are setting the class path to:
    For a .jar or .zip file that contains .class files, the path ends with the name of the .zip or .jar file.
    For .class files in an unnamed package, the path ends with the directory that contains the .class files.
    For .class files in a named package, the path ends with the directory that contains the "root" package (the first package in the full package name).
    Multiple path entries are separated by colons.
    The default class path is the current directory. Setting the CLASSPATH variable or using the -classpath command-line option overrides that default, so if you want to include the current directory in the search path, you must include "." in the new settings.
    Classpath entries that are not either a directory or an archive (.zip or .jar file) are ignored.

  • How to set the variable of "path" and  classpath" in winxp

    I down a sdk1.4.2_01 and use it in windows xp system,I can use "javac";
    but when I run "java *****"(eg: java abc),it do not work.
    The infomation is "Exception in thread "main" java.lang.NoclassfoundError:"
    I set my source code "C:\j21".
    PATH:
    C:\j2sdk1.4.2\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
    CLASSPATH:
    C:\j2sdk1.4.2\lib\tools.jar;.;c:\jdk1.4\lib\dt.jar;C:\j21;
    I am a new user and need your help.
    Email: [email protected]

    http://java.sun.com/j2se/1.4/install-windows.html#Environment
    hope this help!!! java tutor style :D

  • How to set BO SDK path and classpath in cmd

    Hi,
    I am new to BO sdk .. I am working on BO XIR2 SDK. I need to run the java program using command prompt. In lib directory of the BO SDK, I have jar files.Could anybody let me know how to set the path, classpath related to BO SDK in command prompt?
    Regards,
    Nisha

    Hi Nisha,
    Use like this
    set path=%PATH%;C:\Program Files\Java\jdk1.6.0_30\bin
    set CLASSPATH=%CLASSPATH%;D:\javaprograms\JAR Files\sqljdbc4.jar
    cd C:\Program Files\Java\jdk1.6.0_30\bin
    java happy2
    In  line1 : We are setting the Path
        line2 : We are setting Classpath
        line3 : Navigating to actual execution directory
        line4 : Executing the actual java class file
    Hope this helps!
    Regards,
    Mani

  • How do I sett path and classpath in win98

    I have downloaded I have tried but it doesn't work...
    I just don't know how to do, almost tried everything (not the
    right way of course)!
    I would really be happy if someone could tell me how to do!

    The installation instructions are supplied with the JDK download. Otherwise, I found them on this site after 1 minute of searching
    http://java.sun.com/j2se/1.4.1/install-windows.html
    Work your way through these, and if you are still having troubles, feel free to post back here with details of the specific problem you have.

  • I am trying to install itunes 10 but error messages saying could not update the environment variable PATH and CLASSPATH appear. how can i fix this?

    this is really frustrating ive been googling for hours trying to find the solution! any help would be greatly appreciated. I have windows 7 and the newest gen ipod nano

    For general advice see Troubleshooting issues with iTunes for Windows updates.
    The steps in the second box are a guide to removing everything related to iTunes and then rebuilding it which is often a good starting point unless the symptoms indicate a more specific approach. Review the other boxes and the list of support documents further down the page in case one of them applies.
    Your library should be unaffected by these steps but there is backup and recovery advice elsewhere in the user tip.
    tt2

  • Problem with Class and Classpath

    Hello ME Windows Users, now before you place a wry smile on your face, I have a problem with path and classpath. Stop it, I can see you smiling!
    By visiting the the last 10 pages of the forum and reading Sun installation notes, some tooldocs and by given some answers by some nice people, I have become an expert in turning off my computer, about 10 times/hr. I still am trying to make my first cup of java.
    With the ME computer,
    I'm unable to right click on the desktop and go to properties, advanced,
    I'm unable to go go start, run, sysedit,
    I'm unable to change the ms-dos window of autoexec.bat, it just shuts down.
    Now before you tell me, I should of bought a different computer, the only place I can find to modify the path and classpath is in the environment which is in system configuration under tools. Here I have placed numerous configurations, like
    C:\java>set path=%path%;c:\j2sdk1.4.2\bin
    C:\java>set classpath=%classpath%;.;
    ;java_dir\bin where ;java_bin is c:\j2sdk1.4.2
    .; java_dir\bin; %path% where ;java_bin is c:\j2sdk1.4.2 and the list goes on.
    But, I know you are still smiling, the % signs comes up in a dialog box, saying too many, and will not convert the text to the environment to be saved when I close down for the tenth time in the last hour.
    Can someone help me before I make a real cup of coffee and accidentally drop it on the ME box.
    Have a laugh on me Mik.

    C:\java>set path=%path%;c:\j2sdk1.4.2\binGood
    But it is no good because it has to many % and a dialog box appears, saying you have too many parameters.
    Are you saying I have to shutdown again to answer your ?
    From the HELP menu-
    To confirm startup commands line by line
    Click Start, and then click Shut down.
    Click Restart, click OK, and then press and hold the CTRL key until the Windows Startup Menu appears.
    Enter the number for Step-by-step confirmation, and then press ENTER.
    For each command you want to run, press Y.
    If the command runs successfully, you are prompted with the next command.
    If the command does not run successfully, you receive an error message.
    To skip a command, press N.
    Mik

  • Set the path and class path in windows xp professional

    hi guys....could any one tell me step by step on how to set the path and classpath on windows xp professioanl? This is my path and classpath
    set path = %path%;C:\jdk1.3.1_02\bin;c:\JOpen672.jar;c:\
    set CLASSPATH = c:\j2sdkee1.3.1\lib\j2ee.jar;c:\JOpen672.Jar;c:\;c:\postgresql.jar;c:\jai_core.jar
    not working please help me on this thanks alot.
    novicepro

    Below is a Helloworld program, copy and paste it into your editor and save it as "HelloWorld.java" Use capitalization, Java is case-sensitive. If you're using Notepad, quote the name when saving, otherwise Notepad adds ".txt" to the name. Go to DOS and check that you've got the file where you want it and that it's named correctly.
    ----------program HelloWorld.java--------------
    public class HelloWorld {
    public static void main (String[] args) {
    System.out.println("Hello World!");
    In the same directory as HelloWorld.java, enter "javac" - the program should print out a list of options, if not, set your PATH - see below.
    In the same directory as HelloWorld.java, enter "javac HelloWorld.java" and the javac compiler will create HelloWorld.class. If it was successful it will not give any messages. Check that the file is created.
    In the same directory as HelloWorld.java, enter "java -cp . HelloWorld" with the spaces and the period. The program will run.
    Here is additional information:
    The Path is a set of pointers that Windows uses to locate programs that you execute, like javac.exe and java.exe. This setting is explained here:
    http://java.sun.com/j2se/1.4/install-windows.html
    Scroll down to: 5. Update the PATH variable
    (you should have already done this as part of the s/w installation)
    The CLASSPATH is another set of pointers that is used by Java to find the files that you create and want compiled and/or run. This setting is explained here:
    Setting the Classpath:
    http://java.sun.com/j2se/1.4/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/docs/tooldocs/findingclasses.html
    Examples:
    This is my path
    PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\BATCH;C:\J2SDK1.4.0_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.0_1\lib\tools.jar;C:\NetRexx\NrxRedBk

  • Path in Classpath not found

    Hi, all!
    When I create a Web Dynpro-DC, I receive the following warnings:
    [Warning]: Path in Classpath for file _webdynpro_model_dynamicrfc.jar not found.
    and the same for all other Used DCs.
    When I then rebuild the project, none of the referenced packages can be found.
    Anybody got an idea?
    Regards,
    Thomas

    Hi Thomas,
    Are you building a local Web Dynpro DC with NWDS SP15? There's a bug in the SP15 installation: It "forgets" to copy all files starting with a dot (I have noticed that all .dcdef and .buildplugin are missing, I don't know if there are more dot-files). Because of this none of the local SAP standard DCs work. You can copy these files manually in a command prompt window. Makes sure you exit your NWDS before entering the command below while in the installation source folder that contains the "eclipse" folder.
    xcopy *.dcdef "C:\Program Files\SAP\JDT" /s
    Kind regards,
    Pascal

Maybe you are looking for

  • Photoshop 5 Installed on New Win7 computer missing a library to work

    Had purchased Photoshop Elements 5 (don't use Photoshop alot) and when tried to install on new computer after old one crashed has error message that it is missing a library--won't work.  Same as I installed on XP machine.  New machine has Win7 but ha

  • Airport Card drivers missing WIndows XP professionnal 32bit bootcamp

    Hi, I'm employee in a Apple Official resseller store and a customer bought an Imac 21.5 Late 2009 (duo 3.06) and he asked us to install Windows XP professionnal 32 bit (he got his license) on bootcamp. Everything went good, the installation worked pe

  • Run 10g Report in Web Layout

    Hi, I am using Report Builder:10.1.2.0.2 installed on Windows XP (Service Pack 3) and developed simple report. We are using Oracle E-Business Suite R12 and developed report by connecting to the EBS database. I have created "Data Model" and designed "

  • System wide configuration file

    I have a number of EJBs and plain Java Objects that all share a common set of 'configuration properties' that the business would like to configure in run-time to affect how the EJBs work. Hence, I think that defining the same properties per EJB deplo

  • Hi ,my iphone5 hangs when i uninstalled the app

    when i unistall facebook messanger app and nimbuz app,my iphone gets hang,every time i have to reset pnone to come back for normal state.please let me know the solution regards vikas