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?

so5user5
  • 140
  • 1
  • 1
  • 11

1 Answers1

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.

tigerjack
  • 2,575
  • 7
  • 25
  • 38
  • 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. – tigerjack Oct 26 '15 at 09: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. – tigerjack Oct 26 '15 at 10:02