# Revision history [back]

Put this in your ~/.bash_profile and then log out and back in again:

export JAVA_HOME=/usr/lib/jvm/java


The JDKs are in /usr/lib/jvm.

I have it working with no environment variables set and I set "alternatives" to the Oracle JDK. OpenJDK works as well, but Android recommends Oracle.

So, I would suggest that you make sure JAVA_HOME, JDK_HOME, and JRE_HOME are not set. Then use the alternatives command to make the Oracle JDK the default java. Android Studio will figure it out without the environment variables.

Unset java variables for a particular session:

unset JAVA_HOME
unset JDK_HOME
unset JRE_HOME


To unset them permanently, take them out of ~/.bash_profile, ~/.bashrc, or where ever you put them.

Do this once to set the current version of java, choosing the Oracle JDK in /usr/java:

[bill@billslaptop bin]\$ alternatives --config java

There are 2 programs which provide 'java'.

Selection    Command
-----------------------------------------------
*  1           /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.45-40.b14.fc22.x86_64/jre/bin/java
+ 2           /usr/java/jdk1.8.0_45/jre/bin/java

Enter to keep the current selection[+], or type selection number:


export JAVA_HOME=/usr/lib/jvm/java