Changed JAVA_HOME to be read dynamically

- following tip on SO: http://stackoverflow.com/a/1348940/808804