javac: invalid target release: 11
Closed this issue ยท 6 comments
Any pointers what can be done to fix that ?
[INFO] parent ............................................. SUCCESS [ 0.002 s]
[INFO] FrameWorkMinimized ................................. FAILURE [ 14.787 s]
....
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project FrameWorkMinimized: Compilation failure
[ERROR] Failure executing javac, but could not parse the error:
javac: invalid target release: 11
Usage: javac <options> <source files>
use -help for a list of possible options
Hi @shershen08 and thank you for giving MsgViewer a try!
I presume you are using an obsolete version of the JDK.
You can check the version with the following command: java -version
MsgViewer required JDK version 11 at least.
You may fetch the latest JDK here: https://jdk.java.net/
FreeBSD here, I can't remove OpenJDK 8 without also removing Apache Maven.
root@mowa219-gjp4-8570p:~ # pkg query '%o %v %R' openjdk8 openjdk11
java/openjdk8 8.275.01.1 FreeBSD
java/openjdk11 11.0.9+11.1_2 FreeBSD
root@mowa219-gjp4-8570p:~ # java -version
openjdk version "1.8.0_275"
OpenJDK Runtime Environment (build 1.8.0_275-b01)
OpenJDK 64-Bit Server VM (build 25.275-b01, mixed mode)
root@mowa219-gjp4-8570p:~ # which java
/usr/local/bin/java
root@mowa219-gjp4-8570p:~ # ls -hl /usr/local/bin/java
lrwxr-xr-x 1 root wheel 21B Dec 6 17:07 /usr/local/bin/java -> /usr/local/bin/javavm
root@mowa219-gjp4-8570p:~ # ls -hl /usr/local/bin/javavm
-r-xr-xr-x 1 root wheel 22K Sep 10 02:38 /usr/local/bin/javavm
root@mowa219-gjp4-8570p:~ # tail /usr/local/bin/javavm
# Set up the options and run the command
if [ -x "${_JAVAVM_PROG_PATH}/${_JAVAVM_PROG}" ]; then
setJavaOptions "${_JAVAVM_PROG}" "`basename ${JAVA_HOME}`"
export JAVA_HOME
tryJavaCommand "${_JAVAVM_PROG_PATH}/${_JAVAVM_PROG}" ${_JAVAVM_OPTS} "${@}"
fi
echo "${_JAVAVM_PROG}: error: no suitable JavaVMs found" 1>&2
exit 1
root@mowa219-gjp4-8570p:~ # pkg remove -n java/openjdk8
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 14 packages (of 0 packages in the universe):
Installed packages to be REMOVED:
apache-ant: 1.10.8
apache-commons-codec: 1.15
apache-commons-httpclient: 3.1_2
apache-commons-lang3: 3.8.1
apache-commons-logging: 1.2
apache-openoffice-devel: 4.2.1602022694_1,4
hfsexplorer: 0.23.1
icedtea-web: 1.8.4_6
impressive: 0.13.0.b2_2
jdiskreport: 1.4.1
maven: 3.6.3
openjdk8: 8.275.01.1
pdf-renderer: 0.9.1,1
pdftk: 3.1.3
Number of packages to be removed: 14
The operation will free 606 MiB.
root@mowa219-gjp4-8570p:~ # uname -v
FreeBSD 13.0-CURRENT #72 r367936: Sun Nov 22 21:46:00 GMT 2020 root@mowa219-gjp4-8570p:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG
root@mowa219-gjp4-8570p:~ #
Hi @grahamperrin !
I'm not used to FreeBSD but according to this https://www.freebsd.org/cgi/man.cgi?query=javavm&sektion=&manpath=freebsd-release-ports
you can have different Java versions installed simultaneously. All you would have to do is specifying which version you want to use with
env JAVA_VERSION=11+
Note there was a bug with java version > 1.9 that was fixed one year ago : https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=237054
Could you try invoking env JAVA_VERION=11+ java -version
?
Multiple versions already installed:
root@mowa219-gjp4-8570p:~ # pkg query '%o %v %R' openjdk8 openjdk11
java/openjdk8 8.275.01.1 FreeBSD
java/openjdk11 11.0.9+11.1_2 FreeBSD
โ but I needed a nudge to read the relevant manual page.
So:
$ uname
FreeBSD
$ cd ~/Applications/MsgViewer
$ JAVA_VERSION="11" mvn package
โฆ
[INFO] Replacing /usr/home/grahamperrin/Applications/MsgViewer/MSGViewer/target/msgviewer.jar with /usr/home/grahamperrin/Applications/MsgViewer/MSGViewer/target/msgviewer-1.9.0-SNAPSHOT-shaded.jar
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for parent 1.9.0-SNAPSHOT:
[INFO]
[INFO] parent ............................................. SUCCESS [ 0.007 s]
[INFO] FrameWorkMinimized ................................. SUCCESS [ 54.460 s]
[INFO] msgparser .......................................... SUCCESS [ 4.604 s]
[INFO] MSGViewer .......................................... SUCCESS [ 46.385 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:45 min
[INFO] Finished at: 2020-12-07T03:06:54Z
[INFO] ------------------------------------------------------------------------
$ exit
grahamperrin@mowa219-gjp4-8570p:~ %
โฆ Could you try invoking
env JAVA_VERION=11+ java -version
?
grahamperrin@mowa219-gjp4-8570p:~ % env JAVA_VERION=11+ java -version
openjdk version "1.8.0_275"
OpenJDK Runtime Environment (build 1.8.0_275-b01)
OpenJDK 64-Bit Server VM (build 25.275-b01, mixed mode)
grahamperrin@mowa219-gjp4-8570p:~ %
โ but no matter; I have the BUILD SUCCESS above. Thanks ๐
Yeah, my syntax was approximative :)
Anyway, I'm happy you could run MsgViewer. Looking forward to reading your feedback