aspose file tools*
The moose likes Beginning Java and the fly likes Need Help Setting variable Path to bin Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Need Help Setting variable Path to bin" Watch "Need Help Setting variable Path to bin" New topic
Author

Need Help Setting variable Path to bin

Cameron Gose
Greenhorn

Joined: Oct 09, 2005
Posts: 3
I am running Windows XP and I set the value of the Path variable to C:\j2sdk1.4.2_09\bin in both the user variables and system variables, and I cannot get the command prompt to recognize javac or %java. I cannot figure out what I did wrong, I followed the installment instruction and it still failed. Can someone please help.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Does the install work without the PATH variable? That is, what do you get when you enter the full path at the prompt? For example...

C:\j2sdk1.4.2_09\bin\javac MyClass.java

If providing the full path does not work, then the problem might be in the installation rather than the PATH variable. If it does work, then are you starting a new Command Prompt session after setting the PATH variable?

Note: Here are Sun's instructions for installing 1.4.2 on Windows, although what you described in your original post appears correct...

http://java.sun.com/j2se/1.4.2/install-windows.html
[ October 11, 2005: Message edited by: marc weber ]

"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
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9052
    
  12
How did you go about setting the path?

Also, if you're running on windows, you want to type C:\>java not C:\>%java


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Cameron Gose
Greenhorn

Joined: Oct 09, 2005
Posts: 3
When I set the path I opened the control panel. Then I went to systems and clicked on the advanced tab then clicked on enviroment variables. Then I went to system variables and User variables and under the path I typed in the java pathat the end of the list of the variable value.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39773
    
  28
Have you set both path and classpath? If you have only set path, it won't work.
Go back to the my computer->properties->advanced->environment variables window, and in its top half, find classpath and edit it.
There will be several classpaths already set up, separated by semicolons ; on Windows. You need to set up the classspath for current folder, which looks like this . a single full stop (dot).
If there isn't somewhere in your classpath variable a dot (mine looks like this:
.;.;C:\PROGRA~1\JMF21~1.1E\lib\sound.jar;C:\PROGRA~1\JMF21~1.1E\lib\jmf.jar;C:\PROGRA~1\JMF21~1.1E\lib;C:\WINDOWS\java\classes;.
) or more likely
;.;
or
.;
or
;.
somewhere in the classpath variable, you have to insert it, simply by putting your cursor (insertion point) just next to one of the semicolons already there, and changing the ; to read
;.;
between the strings already there.
Then click OK and keep doing so until all the dialog boxes vanish . . .
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
Originally posted by Campbell Ritchie:
Have you set both path and classpath? If you have only set path, it won't work.
....


That is not true. Beginners should NOT deal with the CLASSPATH unless other software on the same system is using it. You can compile and run programs just fine without the CLASSPATH set.

Layne
[ October 14, 2005: Message edited by: Layne Lund ]

Java API Documentation
The Java Tutorial
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
Cameron,

Welcome to Java Ranch!

If your are still having problems, please provide us some more information. First of all, how do you know that Windows cannot find javac and java? Do you get an error message? If so, please post it here.

Also, run the following commands to see what happens:

java -version

echo %CLASSPATH%

Please paste the output here and I will be glad to help you from there.

Layne
Cameron Gose
Greenhorn

Joined: Oct 09, 2005
Posts: 3
I got it to work, thanks for your the help
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need Help Setting variable Path to bin