Skip to Content
avatar image
Former Member

installation of J2SDK-setting up of class path

Hi all

i have loaded j2sdk 1.5 for the java dev..i need to set up the class path..my OS is windows xp..

what actually is the classpath setting n pls guide me how to do that

thanks in advance

krishna chaitanya

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Jul 25, 2007 at 06:10 AM

    Java uses classpath to search for any class files, jars or resource files that you may have used in your java programs or those you may require implicitly in your java programs.

    for setting the classpaths you have 2 options : you may either set them while compiling and running java programs or by defining a classpath environment variable.

    for your case you need the basic set up to run java programs which is given below :

    1. Go to start>settings>control panel>system. Click on the advanced tab and then click on Environment variables.

    2. under user variables click on New. in variable name give classpath & in variable value give c:\j2sdk5\bin if your j2sdk(give name of the installed j2sdk folder) is installed in c drive. click ok.

    3. repeat step 2 for system variables.

    4. in the same way as step 2, for both user & system variables create another variable with name java_home & value c:\j2sdk if your j2sdk(give name of the installed j2sdk folder) is installed in c drive.

    5. under system variables click on path variable and then edit(do not click new). then go to the end of variable value & after the written contents write .;c:\j2sdk5\bin

    if your j2sdk(give name of the installed j2sdk folder) is installed in c drive. click ok.

    6. click ok 2 times on the 2 screens. then go to command prompt and write javac. if it doesn't give any error then your problem is solved.

    step 2 & 3 sets up your basic classpath settings. the remaining steps are used to completely set up your j2sdk. if you have to use any jar file in your programs you can add them in classpath variable.

    hope this helps.

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 24, 2007 at 02:04 PM

    Hi Krishna,

    Not sure if I got your question right but hope this is what you are looking for:

    Setting" target="_blank">http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/classpath.html">Setting the class path

    BTW, I'm moving your question to the Java Programming forum which should be more appropriate, I guess.

    HTH!

    -- Vladimir

    Add comment
    10|10000 characters needed characters exceeded