Javac: invalid target release: 11 despite having jre11-openjdk

I have installed and used fastqc from AUR before and recently when I tried to update, I got issues. I investigated the issue to the best of my abilities and also I sought help on the Github page of the AUR maintainer which you can read.

Long story short, I have jre11 and jre8 installed:

❯  pamac list --installed | grep "jre"
jre11-openjdk                             11.0.19.u7-1                  extra      551.0 kB
jre11-openjdk-headless                    11.0.19.u7-1                  extra      167.6 MB
jre8-openjdk                              8.372.u07-1                   extra      417.2 kB
jre8-openjdk-headless                     8.372.u07-1                   extra      104.1 MB

and this is the error I get:

[javac] javac: invalid target release: 11

I have tested this on Arch in a clean-install VM, and it builds just fine with the jre11-openjdk as the following video attests:

I waited over a month before posting here, hoping that some update on Manjaro jre version solves the issue (as I cannot decipher why it is not working). But now in accordance to the maintainer’s suggestion I’m opening this thread hoping for some useful tips and solution.

Please install JDK instead of JRE. JRE is a runtime only environment, JDK is required for compilation. So despite you have JRE 11, your JDK might be… I don’t know, 8?

1 Like

javac is only included in the JDK packages.

Also, use the script archlinux-java to set the global version. See here:
https://wiki.archlinux.org/title/Java

4 Likes

@leledumbo @mithrial Thanks for your comments. but I already have the JDK:

❯  pamac list --installed | grep '^j[(re)(dk)]'
jdk11-openjdk                             11.0.19.u7-1                  extra      337.9 MB
jdk8-openjdk                              8.372.u07-1                   extra      40.4 MB
jemalloc                                  1:5.3.0-2                     extra      2.1 MB
jre11-openjdk                             11.0.19.u7-1                  extra      551.0 kB
jre11-openjdk-headless                    11.0.19.u7-1                  extra      167.6 MB
jre8-openjdk                              8.372.u07-1                   extra      417.2 kB
jre8-openjdk-headless                     8.372.u07-1                   extra      104.1 MB

and javac is in the path:

❯  ls -al $(which javac)
lrwxrwxrwx 1 root root 30 Jan 19 14:33 /usr/bin/javac -> /usr/lib/jvm/default/bin/javac

❯  javac -version                                                                                         -ErrorCode:2-
javac 1.8.0_372

Ok, thanks for the your constructive comments. Although I had JDKs installed, the archlinux-java which @mithrial mentioned was the key:

❯  archlinux-java status
Available Java environments:
  java-11-openjdk
  java-8-openjdk (default)

So by changing the version the issue was resolved:

archlinux-java set java-11-openjdk

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.