This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes environment variable - correct setup is not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "environment variable - correct setup is not working" Watch "environment variable - correct setup is not working" New topic
Author

environment variable - correct setup is not working

Andrew Baba
Greenhorn

Joined: Nov 23, 2011
Posts: 20
Hi,

I have changed Java environment variables good few times recently and I have never had problem like today. I have set up new Win 7 Proffesional 64-bit. I have installed JDK and I am stuck with variables.
Please have a look on pics. I also checked official oracle documentation for win7 and looks like I am doing everything OK.

1. Pic1 displays path on my hdd to my JDK


c:\program files\java\jdk1.7.0_03


2. Pic2 displays what I am going to edit


3. As a result still getting the same answer that javac is not recognised as an internal or external command.

Any ideas what am I doing wrong ?

I also tried to change name path using " ~ "sign to avoid empty spaces like C:\progra~1\... but this is not working either.
I tried close terminal, restart win, after each step.
I tried to change path to c:\program files\java\jdk1.7.0_03\bin

Is there any way to set this up through command line ?
Brian Burress
Ranch Hand

Joined: Jun 30, 2003
Posts: 122
You circle "JAVA_HOME" but then indicated you set the path. "JAVA_HOME" is frequently used by scripts, but does not work for a command line window. You want to make sure you are setting the "PATH" (path) environment variable to include the java bin directory. Take care not to delete or modify any of the current entries in the path variable or you may break something.

As a side comment, you do want to re-open the command line window when changing the path but you should not need to perform a restart of the entire system.
Andrew Baba
Greenhorn

Joined: Nov 23, 2011
Posts: 20
Thank you very much. That's working now.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19655
    
  18

JAVA_HOME should not include the bin folder. That should be part of the PATH, but not JAVA_HOME. My own PATH includes %JAVA_HOME%\bin so I only need to change JAVA_HOME and the PATH will be automatically updated as well.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Brian Burress
Ranch Hand

Joined: Jun 30, 2003
Posts: 122
Rob,

Good suggestion on the %JAVA_HOME% use in the path. Also, thanks for pointing out that JAVA_HOME should not have the bin dir. I focused on answering the question and overlooked that aspect!
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

Also, the value of JAVA_HOME should not have a semi-colon ; at the end. Just the name of the directory: C:\Program Files\Java\jdk1.7.0_03


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3432
    
  12
You also need to change the title of this thraed to environment variable - incorrect setup is not working


Joanne
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: environment variable - correct setup is not working
 
Similar Threads
compiling servlets and jsp and running in tomcat
Failed to install Tomcat5 Service
Setting CLASSPATH via batch file
classpath error
something wrong with JAVAC