[ERROR] Failed to execute goal org.teavm:teavm-maven-plugin:0.6.1:compile (web-client)
on project github-browser: Unexpected error occurred: Unsupported class file major
version 62 -> [Help 1]
This happens if Maven mistakenly points to java version greater than Java 11. This happens on most of the java versions which are greater than 11 Check java home:
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /home/USERNAME/.maven-bin/apache-maven-3.6.3
Java version: 18.0.1, vendor: Oracle Corporation, runtime: /usr/lib/jvm/jdk-18.0.1
Default locale: en_US, platform encoding: UTF-8
OS name: “linux”, version: “5.13.0-27-generic”, arch: “amd64”, family: “unix”
Lets downgrade /usr/lib/jvm/jdk-18.0.1 to jdk 11 using Jenv (Java Environment Manager) and still keep both of the jdk 18 and 11.
Managing multiple JVM versions with Jenv:
Jenv can manage multiple Java verions similar to NodeJS verions manager nvm except you have to download each JDK versions yourself and link them with Jenv like:
command. then linked Java verions can be displayed with jenv versions
command:
should display:
should select Oracle JDK as current Java verion:
Now, to address TeaVMs java verions issues we are going to have both JDK 11 and newer Java verion installed on the system and maintain via Jenv:
#dowload jdk 11
cd ~
wget https://mirrors.huaweicloud.com/openjdk/11.0.1/openjdk-11.0.1_linux-x64_bin.tar.gz
#extract
tar -zxvf openjdk-11.0.1_linux-x64_bin.tar.gz
#install Jenv (Java environment Manager)
git clone https://github.com/jenv/jenv.git ~/.jenv
echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(jenv init -)"' >> ~/.bashrc
#Restart terminal and run:
jenv enable-plugin export
exec $SHELL -l
Should display:
Now addJDK 11
into Jenv:
To check jdk version run:
should display:
Now select Java version to 11:
Check selected java version:
Should display:
Check JAVA_HOME,java and javac version:
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /home/USERNAME/.maven-bin/apache-maven-3.6.3
Java version: 11.0.1, vendor: Oracle Corporation, runtime: /home/USERNAME/jdk-11.0.1
Default locale: en_US, platform encoding: UTF-8
OS name: “linux”, version: “5.13.0-27-generic”, arch: “amd64”, family: “unix”
No comments:
Post a Comment