• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Installing Java and setting up variables path

 
Greenhorn
Posts: 1
Firefox Browser PHP Windows Vista
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm a little embarrassed for asking this but I just can't figure out how to make the java programs to work. I have downloaded Java and went to my computer's system to set the variables path. I have windows vista, so the way I did it was:
JAVA_HOME c:\Program Files\Java\jdk1.6.0_25
and
PATH %JAVA_HOME%\bin; \Java\jdk1.6.0_25\bin
When I check javac version it doesn't work.
What am I doing wrong??
 
Saloon Keeper
Posts: 15490
363
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to CodeRanch, Ofilia.

This may seem silly, but did you restart your command prompt after you set your variables?

Try restarting your PC.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch!

Ofilia Astorga wrote:JAVA_HOME c:\Program Files\Java\jdk1.6.0_25
and
PATH %JAVA_HOME%\bin; \Java\jdk1.6.0_25\bin


What exactly did you set the variables to, and how?

You don't really need to set JAVA_HOME. That environment variable is not used by Java itself. Some other programs need it to know where Java is installed, but not Java itself.

Make sure the bin directory of the JDK is added to your PATH. If you installed the JDK in C:\Program Files\Java\jdk1.6.0_25, then add C:\Program Files\Java\jdk1.6.0_25\bin to the PATH (by adding a ; and then C:\Program Files\Java\jdk1.6.0_25\bin to the existing PATH). Note: Do not put spaces before or after the ;.

As Stephan mentioned, you need to close and re-open the command prompt window after changing environment variables in Windows. The command prompt will not pick up changes in variables while it's open.

Ofilia Astorga wrote:When I check javac version it doesn't work.


What exactly do you mean by that - did you get an error message, and if yes, then what was the error message? If the path is set up correctly, you should be able to use the command:

javac -version

and it will tell you the version of the Java compiler. Note: It must be exactly javac -version, not javac version or anything else. Don't forget the - before version.

(It's important to be precise with the details, because computers only do exactly what you tell them to do - making even a small mistake will cause it to not do what you want it to do).
 
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We have a good FAQ about that.
 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:Welcome to CodeRanch, Ofilia.

This may seem silly, but did you restart your command prompt after you set your variables?

Try restarting your PC.


You don't need to restart the PC, but you do need to restart the application that tries to use the command. In this case, the command prompt window should be closed and reopened.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic