Configure JDK in Android Studio

Asked

Viewed 2,317 times

-1

I need to configure the JDK path in Android Studio via terminal without root access to a script. The computer has JDK/JRE 7, I tried to change the value of some variables: PATH, JAVA_HOME, JDK_HOME, STUDIO_JDK, ... .

On the terminal jdk 8 works by changing the value of the PATH, but when I open Android Studio it only recognizes the JRE.

JRE 8

Graphically via Project Structure I can change the JDK, but I need it via CLI. inserir a descrição da imagem aqui Does anyone know?

  • As far as I know when changes the PATH by the terminal, it is usually temporary, the PATH is changed only to that window/ instance of the terminal, so do not effect Android Studio. To be permanent I find it kind of hard without root.

  • The PATH changed this way is temporary, but this has no relation in the influence with Android Studio, because what counts is how it is time and the idea of the script is always change before opening.

1 answer

0

Android Studio uses the JAVA_HOME variable to get the Java version. You need to use the command below informing your respective Java location:

export set JAVA_HOME=/usr/lib/jvm/java-8-oracle/

That way of default-java does not contain Java 8, you will need to install it. For installation, follow the manual.

  • I had changed this variable, but this only makes Android Studio recognize jre, JDK not.

  • But you put with the path of JDK? If you put with that default will point to a JRE even.

  • I put so much that when I put the value of the JAVA_HOME variable in the JDK Location field of the GUI works.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.