7

I have recently installed Android Studio on my Ubuntu 12.10 64bit machine, but every time that I opened it kept giving the following error "OpenJDK shows intermittent performance and UI issues. We recommend using the Oracle JRE/JDK." After reading this blog post and followng the tutorial, I was able to install Oracle JDK, but android studio keeps showing this error. Is there any particular configuration on android studio that I have to change?

Note: I have already installed Oracle JDK 8u.20.

I did not unnistall Open JDK.

When I run java -version, it shows that I successfully installed Oracle JDK

  • Your Android studio is probably still using OpenJDK. If it is a java app, try to run it using the full path of Oracle java, something like: /usr/share/java_7/bin/java -jar path_to_Androidstudio – Pyrophorus Oct 10 '14 at 11:41
4

I'm using Linux Mint as opposed to Ubuntu, but this information might be relevant

One way or another, you are probably launching Android Studio via the bin/studio.sh shell script. If you open that file in a text editor, you'll see how the following section where the JDK is loaded.

 ---------------------------------------------------------------------
# Locate a JDK installation directory which will be used to run the IDE.
# Try (in order): STUDIO_JDK, JDK_HOME, JAVA_HOME, "java" in PATH.
# ---------------------------------------------------------------------
if [ -n "$STUDIO_JDK" -a -x "$STUDIO_JDK/bin/java" ]; then
  JDK="$STUDIO_JDK"
elif [ -n "$JDK_HOME" -a -x "$JDK_HOME/bin/java" ]; then
  JDK="$JDK_HOME"
elif [ -n "$JAVA_HOME" -a -x "$JAVA_HOME/bin/java" ]; then
  JDK="$JAVA_HOME"
else
  JAVA_BIN_PATH=`which java`
...

In my case, I had the $JAVA_HOME defined in my .bashrc file pointing to my OpenJDK location (probably when I first installed Eclipse or some other software that had instructions on setting a global java location environment variable).

# JAVA HOME
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
export PATH=$PATH:$JAVA_HOME/bin

Since the studio.sh script looks for the environment variable $STUDIO_JDK first, you can simply install Oracle's JDK and define a STUDIO_JDK environment variable in your .bash_profile or .bashrc to point to this installation. I have not yet done so myself, so I will edit this if I run into any issues when I do.

  • Works on Ubuntu 15.04. :) – Anonsage Aug 9 '15 at 4:14
3

I don't have an exact solution, but I figure I share my experience since finding this question helped me resolve my issue. I was just having the same issue as you with Linux Mint 17 x64, also using JDK 8u20, and stumbled upon your post, which led me to the blog post you linked in your post. Following those steps resolved my issue without having to make any changes to Android Studio. I just executed the commands, restarted Android Studio and the notification was gone.

My only suggestion I could say is to make sure you're getting the commands correctly and when doing the two commands

sudo update-alternatives --config java 

sudo update-alternatives --config javaws

that you ensure you're selecting the correct number selection ID to the newer JDK

/usr/lib/jvm/jdk1.8.0_20/bin/java

My selections were 2 and 3, respectively, for those two commands.

Hope that helps narrow a solution down for you. Thanks for helping me, I hope that helps you narrow down a solution. Good luck.

  • Fixed my issue, thanx! – BMB Jul 28 '15 at 5:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.