I was not able to install the R-package FSelector, because a dependency could not be installed properly.

Many frameworks and tools require the existence of an special environment variable directing to your java installation called JAVA_HOME. Here I will explain how to set it on linux and Mac OSX.