How can I set JAVA_HOME on Ubuntu 14.04?
There are two common places where you can put the
The difference is that the first file is run when you start a terminal. This makes sense because most programs that you need to use when you program in Java are command line tools (Gradle, Maven). However, sometimes you need to start a Java-based GUI program without opening a terminal (for example, by clicking on its shortcut on desktop). If it requires
JAVA_HOME, chances are it will not work. That’s why defining
.profile is better in these situations.
You usually want to have
javac available, so you should define
JAVA_HOMEand add the
bin directory to the
PATH. This is how: