jQuery in Action, 3rd edition
The moose likes Beginning Java and the fly likes path and class path settings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "path and class path settings" Watch "path and class path settings" New topic

path and class path settings

Chris Buskulic

Joined: Sep 23, 2003
Posts: 5
I was just wondering how I would go about setting the path and the claspath on my pc so that I can run the download of JD2SDK.
Wayne L Johnson
Ranch Hand

Joined: Sep 03, 2003
Posts: 399
First, set the "JAVA_HOME" environment variable to the path where you installed the JDK. Mine is set to "C:\j2sdk1.4.2".
Second, add %JAVA_HOME%\bin to your "PATH" variable.
Finally, add "C:\MyJava\classes" [or the appropriate directory] to your CLASSPATH variable. This is the root directory of your packages. If you have more than one root directory, then you can specify multiple paths.
If you have JAR files, you can either put them into "%JAVA_HOME%\jre\lib\ext", where they will be picked up automatically, or you can add them to your classpath.
If you are on Win9x, you set everything up in your "C:\autoexec.bat" file. If you are on WinNT/2K/XP, then they are set using environment variables. I right-click the "My Computer" icon, select "properties" and then go to the "Advanced" tab. From there you should see a "Environment Variables" button that will take you to where you can set everything up. Keep in mind that if you are on Win9x you'll have to re-boot before the settings take affect.
If you are on Unix/Linux, you can do the same thing in your login profile. The main difference is that you use the slash (/) instead of back-slash (\) as the directory separator, and the colon ( instead of the semi-colon ( to separate different paths.
Once you get the hang of everything, you might want to look into using ANT to manage all of you projects.
[ September 23, 2003: Message edited by: Wayne L Johnson ]
Chris Buskulic

Joined: Sep 23, 2003
Posts: 5
I went through and did what I was told and I am still recieving error messages.
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1873
Hi Chris,
It would be really useful if you let us know what error messages you are getting and what you are trying to do (meaning what is your directory where you write code, which code you are trying to compile/run etc..)
What Wayne suggested should have worked.
Kristol Crawley

Joined: Sep 17, 2003
Posts: 7
You may have solved this issue already BUT, on every machine I've ever used (with Windows os) I always have to add this to my classpath:
I agree. Here's the link: http://aspose.com/file-tools
subject: path and class path settings
It's not a secret anymore!