on 07-24-2007 12:56 PM
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.