File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes I can't manage to set PATH and JAVA_HOME properly. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "I can Watch "I can New topic
Author

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

Andreas Johannessen
Greenhorn

Joined: Jan 11, 2012
Posts: 3
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

Joined: Oct 02, 2003
Posts: 11175
    
  16

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.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3432
    
  12
What are you setting the PATH and JAVA_HOME variables to ?


Joanne
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38107
    
  22
Welcome to the Ranch

We have an FAQ which tells you how to set your PATH.
Andreas Johannessen
Greenhorn

Joined: Jan 11, 2012
Posts: 3
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

Joined: Jan 11, 2012
Posts: 3
Bumping this thread as it is really important for me!
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3432
    
  12
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

Joined: Oct 13, 2005
Posts: 38107
    
  22
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

    Joined: Jan 11, 2012
    Posts: 60

    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).


    "How do you define fool?"
    "I don't attempt it. I wait for demonstrations. They inevitably surpass my imagination."
    Jesper de Jong
    Java Cowboy
    Saloon Keeper

    Joined: Aug 16, 2005
    Posts: 14074
        
      16

    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.


    Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
    Scala Notes - My blog about Scala
     
    jQuery in Action, 2nd edition
     
    subject: I can't manage to set PATH and JAVA_HOME properly.
     
    Similar Threads
    where is the file that we can add/edit env parameters in it?
    Confusion with environment variables
    Issues with checking that my JDK is configured properly
    Installing JDK
    JRE and settings