This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have been trying all day to set my path and classpath so I can run javac and java from the Windows XP command line. I am taking an online class and can't get past this first step that is required. I feel like I have a decent grasp of the java language but this problem is holding everything up. I have tried using multiple resources to figure out how to get it done with zero luck. I even bought a PC because all of the instruction was PC based, I already have a Mac. I am ready to throw the PC out the window just about now. Can anyone help or point me in the right direction?
Originally posted by martin barfield: ...I even bought a PC because all of the instruction was PC based, I already have a Mac. I am ready to throw the PC out the window just about now. Can anyone help or point me in the right direction? ...
Yes, head towards an outside wall, locate a window, and toss the PC through it. (As you probably know, Java comes configured and ready to go on a Mac. )
But if you decide to keep struggling with a Windows machine...
Do not set a system CLASSPATH variable. If you have already set this, then remove it entirely.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Joined: Feb 13, 2006
Thank you Ranch Hand Keith and Bartender Marc. I have been able to get to and edit the environment varibles but have been apprehensive as to what to do from there. It makes me nervous everytime I make system changes under the hood, I don't yet have a back-up drive to use as a safety net.
Hopefully, the link Marc included helps. The Java site at Sun, while very thorough is a bear to navigate when you aren't sure what you are looking for. Who would have thunk that my issue was grouped into an installation notes page, I thought installtion was done when you downloaded and followed the prompts.
I have a batch file that sets the PATH when I want to play with Java in a command window. That way I don't have to mess with system variables at all. Here's what SETJAVA5PATH.BAT looks like this. Let me know if the syntax is unfamiliar and needs explanation ...
The "java -version" command on the end confirms that I got it right. Now I can run java and javac. Most of the time my command window experiments are very simple and don't need other jars. If you do need other jars or packages, you can set the classpath as an environment variable, or pass it to the java and javac commands as an argument.
Here's a short tutorial on some of the issues around classpath and packages. See if it helps or confuses.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Originally posted by martin barfield: ... The Java site at Sun, while very thorough is a bear to navigate...
True, but it's a lot better than it was several years ago!
I know what you mean about messing with Windows settings, but this isn't too dangerous (like editing the Registry, for example). If you want a backup, you can simply copy what's already in the PATH value and save it as a simple text file. Just make sure you capture the entire string of values. Then if you really mess it up, just paste the text back in.
Keep in mind that the PATH variable is just a list of different paths that the system tries from left to right when executing a command. It uses the first path in the list that works. So just leave whatever is already in the PATH variable where it is, and add your stuff to the right of that. In Windows, each item in the list must be separated by a semicolon, and make sure that you don't introduce any extra spaces.
Note: In Sun's instructions, you need to replace <version> with whatever version you're using. So, for example, if you've downloaded Java 1.5 update 7, then replace "jdk-1_5_0_<version>" with "jdk-1_5_0_07". [ July 13, 2006: Message edited by: marc weber ]