JAVA_HOME should point at where the JDK is installed not not a JRE.
So, if you type ls $JAVA_HOME what do you see? if you do ls $JAVA_HOME/bin/ do you see javac?
If the first doesn't work then you don't have JAVA_HOME pointing at the right directory. If the second doesn't work then you need to point JAVA_HOME at a JDK instead of a JRE.