Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting JAVA_HOME to point to JDK properly?

Hello I have a noob question. I am trying to run Android Studio on my Arch Linux in the /android-studio/bin directory using: ./studio.sh. However, I keep receiving this message: JDK Required: 'tools.jar' seems to be not in Studio classpath. Please ensure JAVA_HOME points to JDK rather than JRE.

So what I did was opened ~/.bashrc and inserted this JAVA_HOME='/java-7-openjdk/jre' export JAVA_HOME PATH="$JAVA_HOME/bin:$PATH" export PATH

After rebooting, I still came across the following issue of the requirement. I am confused as to which part of the /path/to/java goes in JAVA_HOME='?????'

In the terminal, when I do which java, it shows /usr/bin/java and when I do whereis java, it shows java: /usr/bin/java /usr/share/java /usr/lib/jvm/java-7-openjdk/jre/bin/java /usr/share/man/man1/java.1.gz

and as for archlinux-java status it also shows java-7-openjdk/jre (default) what is the exact path to put specifically?

like image 865
NoobInTraining Avatar asked Sep 01 '25 17:09

NoobInTraining


2 Answers

Firstly, using locate to find out where the tools.jar was located:

updatedb && locate tools.jar

Sample output

/opt/jdk1.7.0_55/db/lib/derbytools.jar
/opt/jdk1.7.0_55/lib/tools.jar
/opt/jdk1.7.0_55/lib/visualvm/visualvm/modules/com-sun-tools-visualvm-tools.jar

Then set JAVA_HOME,PATH on ~/.bashrc

export JAVA_HOME=/opt/jdk1.7.0_55
export JRE_HOME=/opt/jdk1.7.0_55/jre
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/jre/bin

after that relogin session or

source ~/.bashrc
like image 165
TrungND Avatar answered Sep 04 '25 06:09

TrungND


use java 8 for android studio

i think it will take only java 8

like image 40
Hemant Ukey Avatar answered Sep 04 '25 07:09

Hemant Ukey