2

On Ubuntu 14.04 I recently installed Android Studio v1.0.1 and noticed that it warns against using the OpenJDK due to "intermittent performance and UI issues." As recommended, I installed the Oracle JRE and JDK, and updated my path and environment. When I launch Android Studio from the command line android-studio/bin/studio.sh the warning is gone and all appears good.

Inside Android Studio there is the option to create a Desktop Entry (Tools > Create Desktop Entry...). When I do that, and launch the desktop entry I see the warning about using OpenJDK again. Does anyone know what it might be doing differently when using this desktop entry as opposed to me running the script myself on the command line?

I have found a similar question on Stack Overflow here, but alas no answers despite it being posted a year ago. I tried reading through other questions such as this one and this one, but they both seem aimed at fixing the issue when running the application via the script on the command line. None of those solutions resolved the desktop entry for me.

For what it's worth:

$ echo $JAVA_HOME
/usr/lib/jvm/jdk-7-oracle-x64
$ echo $STUDIO_JDK 
/usr/lib/jvm/jdk-7-oracle-x64
$ which java
/usr/bin/java
$ ls -al /usr/bin/java
lrwxrwxrwx 1 root root 22 Nov 26 10:59 /usr/bin/java -> /etc/alternatives/java
$ ls -al /etc/alternatives/java
lrwxrwxrwx 1 root root 38 Dec 22 08:49 /etc/alternatives/java -> /usr/lib/jvm/jdk-7-oracle-x64/bin/java

1 Answers1

1

If you have multiple java versions installed on your Ubuntu machine run the following to choose the one you want as default:

$ sudo update-alternatives --config java

    There are 3 choices for the alternative java (providing /usr/bin/java).

      Selection    Path                                            Priority   Status
    ------------------------------------------------------------
      0            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1071      auto mode
      1            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   1061      manual mode
      2            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1071      manual mode
    * 3            /usr/lib/jvm/java-7-oracle/jre/bin/java          1063      manual mode

$ sudo update-alternatives --config javac

    There are 3 choices for the alternative javac (providing /usr/bin/javac).

      Selection    Path                                         Priority   Status
    ------------------------------------------------------------
      0            /usr/lib/jvm/java-7-oracle/bin/javac          1063      auto mode
      1            /usr/lib/jvm/java-6-openjdk-amd64/bin/javac   1061      manual mode
      2            /usr/lib/jvm/java-7-openjdk-amd64/bin/javac   1051      manual mode
    * 3            /usr/lib/jvm/java-7-oracle/bin/javac          1063      manual mode

To get rid of the notifications you have to choose Oracle Java and not the OpenJDK. Installation tutorial for Oracle Java 7

Alex
  • 111