This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I can't manage to set PATH and JAVA_HOME properly.

 
Andreas Johannessen
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks!

I have a little problem here;
Every single time i try to use the javac -version i get the "command not found" (or what it is in English) output. What I've done is only to delete the previous Path variable (which didn't lead to a Java program in the first place) and create a new PATH and a new JAVA_HOME. Still when i enter in the command it dosen't work. What could i possibly be doing wrong here?

Also, in the book im currently trying to learn from, even though i have only got to the set up Java part, it stands something about a API. Isn't API documentation some sort of GUI for the Java library? Does the JDK7 include this?


Thanks a bunch!
 
fred rosenberger
lowercase baba
Bartender
Posts: 12087
29
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what OS are you using? Setting it varies.

note that you usually have to close any open command windows/sessions for the change to get picked up.

and deleting a PATH variable can be dangerous...it could break all kinds of things, so proceed with caution.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are you setting the PATH and JAVA_HOME variables to ?
 
Campbell Ritchie
Sheriff
Posts: 48448
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

We have an FAQ which tells you how to set your PATH.
 
Andreas Johannessen
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the welcome! (and i have already been on the FAQ, that is why i am posting this in the first place. I wouldn't now a thing about PATH or JAVA_HOME before that.)

Well, i have got Windows 7 64-bit. The "Path" i deleted was only for one single program, and i can't seem to find any other paths. Also, there is only like 5 system variables, is this normal?


Thank you for replies, can't wait to set this up and learn java!



Edit:

I am setting the PATH to "%JAVA_HOME%\bin;" and the JAVA_HOME to C:\Programfiles(x86)\Java\jdk1.7.0_02
 
Andreas Johannessen
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bumping this thread as it is really important for me!
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andreas Johannessen wrote:I am setting the PATH to "%JAVA_HOME%\bin;" and the JAVA_HOME to C:\Programfiles(x86)\Java\jdk1.7.0_02

Is the value of JAVA_HOME correct ? On a UK version of Windows 7 it would contain spaces (C:\Program files (x86)\Java\jdk1.7.0_02), although I realise the name does vary on different language installations.

Are these variables set permanently (using Control Panel/System) or do you enter them manually in your command prompt ?
Copy and paste the commands you type and the output you get to here

Try changing directory to %JAVA_HOME%\bin and then typing
java
or
.\java

Copy and paste the commands you type and the output you get to here
 
Campbell Ritchie
Sheriff
Posts: 48448
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andreas Johannessen wrote:Bumping this thread as it is really important for me!
Please read this.

You have not asked for any more information, so what are we supposed to tell you?
You ought to tell us things:
  • What was the path entry you deleted?
  • What is the remaining path?
  • What problems are you experiencing now?
  • Did you add that path entry at the beginning, middle or end of the path?
  • You should only delete a path entry if you wrote it in the first place.
    And to be pedantic, your path entry is not "%JAVA_HOME%\bin;" but "%JAVA_HOME%\bin". The semicolon is a separator from the next entry.
     
    Noam Ingalls
    Ranch Hand
    Posts: 60
    Chrome Firefox Browser Linux
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Also, what version of Java did you install? There's x86 and x64 versions-- if you installed both things could get weird pretty fast in my experience (Still trying to fix my JDK install on my new laptop).
     
    Jesper de Jong
    Java Cowboy
    Saloon Keeper
    Posts: 15207
    36
    Android IntelliJ IDE Java Scala Spring
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    It's possible to have multiple versions of the JDK installed at the same time (as long as you install them in different directories) - so it should not be a problem to have for example the 32-bit (x86) and 64-bit (x64) version of JDK 7 installed at the same time.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic