Is it possible to set the JAVA_HOME env in El Captitan?
The only way I got this to work was by setting this environment variable in the .bashrc file, which incidentally, isn't created in the users home directory by default.
Thanks to patrix's comments on my question which led to this solution.