Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDK 17 not working #29

Open
voidpointer0x00 opened this issue Mar 22, 2022 · 8 comments
Open

JDK 17 not working #29

voidpointer0x00 opened this issue Mar 22, 2022 · 8 comments

Comments

@voidpointer0x00
Copy link

Although I chose JDK17 java and mvn will not change from Java 1.8, which causes the build to fail.
I also tried to install Java 17 through jabba, but then came across another issue — I've no clue how to install another maven. Tried to download from Apache CND server, but it also failed.

build.log
The project on JitCI

@codehz
Copy link

codehz commented Apr 20, 2022

workaround: add JAVA_HOME=/home/jitpack/tools/jdk17

@voidpointer0x00
Copy link
Author

workaround: add JAVA_HOME=/home/jitpack/tools/jdk17

26.	The JAVA_HOME environment variable is not defined correctly
27.	This environment variable is needed to run this program
28.	NB: JAVA_HOME should point to a JDK not a JRE

Do I mess it up? 😄
https://jitci.com/gh/NyanGuyMF/locale-module/19#

Settings screenshot

jitci com_gh_NyanGuyMF_locale-module (4)

@codehz
Copy link

codehz commented Apr 21, 2022

hmmm, at least it is working for me: (btw I use gradle)
image
https://jitci.com/gh/codehz-mcmods/vanilla-laser/builds/b1G0Z635012N1Q1VRD3S3T1Z9R/build.log
My project require java 17 to working
I think it is related to maven

@codehz
Copy link

codehz commented Apr 21, 2022

Workaround:
add to init command (copied from my log

wget -nv https://download.java.net/java/GA/jdk17.0.1/2a2082e5a09d4267845be086888add4f/12/GPL/openjdk-17.0.1_linux-x64_bin.tar.gz -O /home/jitpack/tools/jdk17/jdk17.tar.gz
tar xfz /home/jitpack/tools/jdk17/jdk17.tar.gz --strip-components=1 -C /home/jitpack/tools/jdk17

@gmitch215
Copy link

Was a solution ever reached? I've tried both workarounds (I also use maven) but it doesn't work.

@voidpointer0x00
Copy link
Author

I haven't tried the second yet, but I believe it also won't work, because the maven issue will still remain :)

@gmitch215
Copy link

After playing around with the JitCI, and looking through the path dirs, I've found a solution:

The reason why above solutions didn't work was because the JAVA_HOME isn't actually in the PATH environmental variable.
JitCI has all of the programming language's executables (Java, Python, Go, etc.) in one directory (/usr/bin). They removed the sudo command so you can't edit these files, but you CAN edit the PATH variable, allowing you to update your java version.

I'm not sure if setting to JDK17 will update these files in here. For some reason, maven does point to JAVA_HOME, but the actual shell doesn't.

As for my solution, you simply just need to install JDK17 (I use Adoptium), put it in that tool directory, and update the PATH environmental variable so that JDK17 gets scanned first.

Put this before running any Java Commands:

rm -rf /home/jitpack/tools/jdk17/
mkdir /home/jitpack/tools/jdk17/
wget -nv https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.3%2B7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.3_7.tar.gz -O /home/jitpack/tools/jdk17/jdk17.tar.gz
tar xfz /home/jitpack/tools/jdk17/jdk17.tar.gz --strip-components=1 -C /home/jitpack/tools/jdk17
JAVA_HOME=/home/jitpack/tools/jdk17/
PATH="$JAVA_HOME/bin:$PATH"

Running mvn --version and java --version gives you this:

19.	+ mvn --version
20.	Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
21.	Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-04T19:00:29Z)
22.	Maven home: /opt/apache-maven-3.6.1
23.	Java version: 17.0.3, vendor: Eclipse Adoptium, runtime: /home/jitpack/tools/jdk17
24.	Default locale: en, platform encoding: UTF-8
25.	OS name: "linux", version: "4.18.0-13-generic", arch: "amd64", family: "unix"
26.	+ java --version
27.	Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
28.	openjdk 17.0.3 2022-04-19
29.	OpenJDK Runtime Environment Temurin-17.0.3+7 (build 17.0.3+7)
30.	OpenJDK 64-Bit Server VM Temurin-17.0.3+7 (build 17.0.3+7, mixed mode, sharing)

@voidpointer0x00
Copy link
Author

This makes sense, thanks :)
I'll try it and tell if it works for me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants