Your $JAVA_HOME variable should point to the Home directory, not the bin directory, so change your env variable to:
$ export JAVA_HOME='/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/'
Question
I have a background in pyton and javascript. For my work I would like to develop some extra skills in the scala language. I needed java 7 for Coursera's Functional Programming course to get the homework assignments tool to work. Unfortunately, none of the java tools seem to work on my machine after deinstalling java 8 and installing java7.
In the terminal I get this;
$ java
Unable to locate an executable at "/Library/Java/JavaVirtualMachines/Home/bin/java" (-1)
$ scala
Unable to locate an executable at "/Library/Java/JavaVirtualMachines/Home/bin/java" (-1)
$ sbt
Unable to locate an executable at "/Library/Java/JavaVirtualMachines/Home/bin/java" (-1)
It seems like java cannot find the right jdk, so I changed the JAVA_HOME
variable. In my .zshrc
file I have the following defined;
export $JAVA_HOME='/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/bin'
Oddly, to me, this gives an error when I start up a new terminal.
/Users/code/.zshrc:80: /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/bin not found
This is odd to me because I can cd to this link from the terminal. And from there I can confirm that it exists;
$ pwd
/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/bin
$ ls
appletviewer java jcmd jmc jstatd policytool servertool
apt javac jconsole jps jvisualvm rmic tnameserv
extcheck javadoc jdb jrunscript keytool rmid unpack200
idlj javafxpackager jhat jsadebugd native2ascii rmiregistry wsgen
jar javah jinfo jstack orbd schemagen wsimport
jarsigner javap jmap jstat pack200 serialver xjc
Again, I am rather new to java and even more new on how the terminal variables need to be defined for it to work, so I might be missing a huge point. What step am I missing?
La solution
Your $JAVA_HOME variable should point to the Home directory, not the bin directory, so change your env variable to:
$ export JAVA_HOME='/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/'