Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need Help Setting variable Path to bin

 
Cameron Gose
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Marilyn de Queiroz
Sheriff
Posts: 9066
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How did you go about setting the path?

Also, if you're running on windows, you want to type C:\>java not C:\>%java
 
Cameron Gose
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 49789
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got it to work, thanks for your the help
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic