cancel
Showing results for 
Search instead for 
Did you mean: 

installation of J2SDK-setting up of class path

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi somnath

i created a new user variable 'class path' and a new system variable classpath.

since i installed my j2sdk in G i gave the variable value as G:\Program Files\Java\j2sdk1.5.0\bin

in the same way i created java_home both in user n system variable n gave the path G:\Program Files\Java\j2sdk1.5.0

after doing it i edited the path variable in system variable as

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;G:\Program Files\QuickTime\QTSystem\;G:\Program Files\Javaj2sdk5\bin

javac is not an internal r external command is the msg i am getting in command prompt

thanks in advance

krishna chaitanya

Former Member
0 Kudos

Hi Krishna,

You path variable has some silly mistake.

u r path should be

Path : %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;G:\Program Files\QuickTime\QTSystem\;G:\Program Files\Java\j2sdk5\bin

i.e u have given JavaJ2sdk5 altogether but it should be separated by slash that what i saw the path given by u in classpath....

Thanks

ritu

Former Member
0 Kudos

Hi ritu

i modified it

when i type javac to check whether its working its showing the same error msg

thanks in advance

krishna chaitanya

Vlado
Advisor
Advisor
0 Kudos

Hi Krishna,

Read carefully - all you need to do is described in the posts above!

In your case, since you mentioned that you installed in <b>G:\Program Files\Java\j2sdk1.5.0\bin</b> your PATH variable should be extended with the exact same value, so you end up with:

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;G:\Program Files\QuickTime\QTSystem\;<b>G:\Program Files\Java\j2sdk1.5.0\bin</b>

HTH!

-- Vladimir

Former Member
0 Kudos

Hi all of u

i just solved it..

regards

krishna chaitanya

Answers (1)

Answers (1)

Vlado
Advisor
Advisor
0 Kudos

Hi Krishna,

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

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

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

HTH!

-- Vladimir