Error running studio.sh

0

Hello, I'm new to developing with Java.

I'm using fedora 26 and openjdk java version "1.8.0_91".

My environment variables are:

export JAVA_HOME=/usr/lib/java
export CLASSPATH=$JAVA_HOME/lib/
export MANPATH=$JAVA_HOME/man
export STUDIO_JDK=/opt/android-studio/bin/
export PATH=$PATH:$JAVA_HOME/bin/:$CLASSPATH:$STUDIO_JDK

When I run studio.sh it gives the following error

  

JDK Required: 'tools.jar' seems to be in Studio classpath.   Please ensure JAVA_HOME points to JDK rather than JRE.

Is there anything else to run android studio for linux?

    
asked by anonymous 24.10.2017 / 19:06

1 answer

1

Make sure your JDK is properly installed with

dpkg --list | grep -i jdk

If it is not, reinstall. Then enable your JDK:

update-alternatives --display java

Check the installed version with:

java -version

If it's all right, the return will look something like this here:

java version "9.0.1"
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)

Then check out the compiler with:

javac -version

If it's all right, the return will look something like this here:

javac 1.8.0_91

Finally, add JAVA_HOME to your $PATH Edit your /etc/environment and add JAVA_HOME=/usr/lib/jvm/java-8-oracle (or compatable with the Java you downloaded) to the end of the file.

You will have to restart your machine after editing $PATH , you can do it by the same terminal, with:

sudo reboot
    
24.10.2017 / 19:20