Change Java OpenJDK version in Arch Linux

Read Time:48 Second

Issue:

  • When execute npm run android for React Native, the build error occurred as below:
* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin 'com.android.internal.application'.
   > Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
     You can try some of the following options:
       - changing the IDE settings.
       - changing the JAVA_HOME environment variable.
       - changing `org.gradle.java.home` in `gradle.properties`.

Solution:

  • It’s because currently Java version is lower than 11.
  • Assuming already has another Java JDK, simply change Java for Arch Linux.
$ sudo archlinux-java status 
Available Java environments:
  java-17-openjdk
  java-8-openjdk (default)
$ sudo archlinux-java set java-17-openjdk
$ java -version
openjdk version "17" 2021-09-14
OpenJDK Runtime Environment (build 17+35)
OpenJDK 64-Bit Server VM (build 17+35, mixed mode)

Reference: https://edgardorl.com/blog/configure-java-in-arch-linux-to-run-a-react-native-application/

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.