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
  • Edit the desktop entry and paste the code here, so that we can see what seems to be the problem – Avishek Saha Jul 08 '17 at 14:05
  • I'm sorry, I don't actually have that computer anymore and don't have the same setup on my new computer. I haven't had this issue lately so I can't add anything else. If anyone else with the same problem comes across this issue please comment and I'll be happy to update the question with their info. – Matthew Pape Jul 11 '17 at 19:38

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
  • Good idea. This is something I hadn't tried earlier. Unfortunately it did not solve my problem. I tried the following without any luck:
    1. set the oracle version of java as the default
    2. remove the desktop entry for Android Studio
    3. reboot
    4. launch Android Studio from the script (works like always)
    5. create new desktop entry
    6. close Android Studio
    7. launch Android Studio from desktop entry (same warning as always)
    – Matthew Pape Mar 31 '15 at 20:22
  • Maybe check again if it saved your config regarding Oracle Java. For me it worked after a reboot, no need to remove and recreate your desktop entry – Alex Apr 01 '15 at 04:54