0

i am facing the same issue as mentioned in the following link JAVA_HOME points to the wrong place

but this is eclipse, and I am facing it in DOS command promp > ant jar

Note: i have updated enviro variables correctly(JAVA_HOME and ANT_HOME)

Community
  • 1
  • 1
lowLatency
  • 5,534
  • 12
  • 44
  • 70
  • Check if your PATH environment variable contains %JAVA_HOME%\bin (in windows) or $JAVA_HOME/bin in linux/os x – pabrantes Nov 29 '12 at 10:42
  • Your problem is probably related to [this topic](http://stackoverflow.com/questions/2162121/eclipse-will-not-open-due-to-environment-variables). – Sergio Nakanishi Nov 29 '12 at 11:03

2 Answers2

2

Check your registry to see if the path has been updated there. I experienced a similar problem and was able to fix it with the following: I'm Using Windows 7 x64

Start-> Run-> "regedit".

In the Registry goto:

Computer -> HKEY_LOCAL_MACHINE -> SOFTWARE -> JavaSoft -> Java Runtime Environment

Check to see if JavaHome points to the right location, you can modify it if need be. Mine for example reads:

C:\Program Files\Java\jdk1.7.0_45\jre

and the RuntimeLib reads:

C:\Program Files\Java\jdk1.7.0_45\jre\bin\jvm.dll

As for your Ant install, do the same checks, just be sure not to forget the path endings. Hope this helps.

Edit:

I was blown away by the ease of the tool provided in this answer: Submitted by Eric

If anyone is having issues running jar files I highly recommend taking a look at this.

Community
  • 1
  • 1
JReyn
  • 99
  • 5
  • +1 this was the problem, after deinstall of Android Studio, the javaHome in the registry was wrong, deinstall of android studio, reinstall did not help, after opening the registry key and deinstall java jre, reinstall java jre, voila, the javaHome was right, without reboot! – Harvey68 Apr 24 '23 at 13:50
0

If you are absolutely sure that you have got JAVA_HOME right under Computer -> ... Environment Variables -> System, then restart your command prompt for it to pick up the new value.

Harald
  • 4,575
  • 5
  • 33
  • 72