locked
set classpath for java RRS feed

  • Question

  •  

    How to set the classpath for java?
    Saturday, September 15, 2007 3:47 AM

Answers

  • Hi saraswathi,

        Goto control panel -> System->Advanced ->Environmental variable -> then add the required Classpath .....

     

    Eg:

    JAVA_home

    c:\Sun\java\jdk1.6.0\bin

    Thats it

    Saturday, September 15, 2007 4:53 AM
  • You can also set path through dos promt

     

    start----->Run---->cmd

     

    then in command prompt type

    %PATH% C:\(whatever your path is)

    we use % so as to add the new path in the old one if we only use path the old settings will be over written.
    Sunday, September 16, 2007 6:52 AM
  •  

    yes tiwari is right ,

       Sample format for that is ....

     

    Set classpath=%classpath%; <the path to bin folder> ;

     

    regards

    Mohan

    Sunday, September 16, 2007 8:42 AM
  • Thanx frds for answering to my query

    and i am able to set the path now

    in environment variables we can create a new one or we can update the existed variable, named as PATH

    and we can also set the path in cmd prompt as

    set PATH=c:\............. where path exits;c:\windows\system32;

    set CLASSPATH=

     

     

    Monday, September 17, 2007 2:42 PM
  • The better way is to add the path in the System environment, so that it loads up everytime you boot into windows, and you dont need to type the path command in dos everytime you start a new cmd /command window.

    You can append the path of the java.exe and javac.exe file in the PATH variable  (multiple paths are seperated by ; (semicolon))
    Also you can add a new cariable called CLASSPATH, or change its value to . (Yes dot) which means CURRENT DIRECTORY, so that everytime you try to execute the .class file using the java.exe, it will automatically search for the .class file in the current dir, and not a pre-set dir.
    Monday, September 17, 2007 2:50 PM

All replies

  • Hi saraswathi,

        Goto control panel -> System->Advanced ->Environmental variable -> then add the required Classpath .....

     

    Eg:

    JAVA_home

    c:\Sun\java\jdk1.6.0\bin

    Thats it

    Saturday, September 15, 2007 4:53 AM
  • In env variable ,shall i create a new variable or edit the existed one(wat should i edit)?

    Saturday, September 15, 2007 5:52 AM
  • You have to create a new one for your java environment classpath !!

    Saturday, September 15, 2007 6:06 AM
  • You can also set path through dos promt

     

    start----->Run---->cmd

     

    then in command prompt type

    %PATH% C:\(whatever your path is)

    we use % so as to add the new path in the old one if we only use path the old settings will be over written.
    Sunday, September 16, 2007 6:52 AM
  •  

    yes tiwari is right ,

       Sample format for that is ....

     

    Set classpath=%classpath%; <the path to bin folder> ;

     

    regards

    Mohan

    Sunday, September 16, 2007 8:42 AM
  • Thanx frds for answering to my query

    and i am able to set the path now

    in environment variables we can create a new one or we can update the existed variable, named as PATH

    and we can also set the path in cmd prompt as

    set PATH=c:\............. where path exits;c:\windows\system32;

    set CLASSPATH=

     

     

    Monday, September 17, 2007 2:42 PM
  • The better way is to add the path in the System environment, so that it loads up everytime you boot into windows, and you dont need to type the path command in dos everytime you start a new cmd /command window.

    You can append the path of the java.exe and javac.exe file in the PATH variable  (multiple paths are seperated by ; (semicolon))
    Also you can add a new cariable called CLASSPATH, or change its value to . (Yes dot) which means CURRENT DIRECTORY, so that everytime you try to execute the .class file using the java.exe, it will automatically search for the .class file in the current dir, and not a pre-set dir.
    Monday, September 17, 2007 2:50 PM