0

I was building Android apps on Android Studio when it asked me to remove OpenJDK and install Oracle JDK. Now, I was using OpenJDK for building Cyanogenmod.

If I wipe off OpenJDK and install Oracle JDK, would CM builds break?

0

Look at this answer to understand the key differences between OpenJDK and Oracle JDK.

If you want to use Oracle Java, you have to install it as Paranoid Panda has suggested. Then you have to set your Java environment variables by adding the following two lines to ~/.bashrc

export JAVA_HOME=/usr/lib/jvm/java-7-oracle
export PATH=$JAVA_HOME/bin:$PATH

If you want, you could also uninstall OpenJDK from your machine at all. Take a look at this answer for the steps to execute to correctly delete it.

  • Java and Android build system are two different things. When you build an Android app, at some point it calls the Java compiler you have installed on your machine; it doesn't matter the exact type of compiler, you should only have one installed. So, when you install Oracle Java and add JAVA_HOME to the $PATH list, you are telling the system where to locate your Java compiler. Once done the above step, you can execute which javac and javac -version to know if the process has gone well. – tigerjack89 Oct 26 '15 at 9:57
  • That being said, you can safely uninstall OpenJDK if you don't want to use it without affecting the build system used by Android. – tigerjack89 Oct 26 '15 at 10:02

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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