balena-minecraft-server icon indicating copy to clipboard operation
balena-minecraft-server copied to clipboard

[BUG] 1.18 needs Java 17

Open MiniGPT opened this issue 5 years ago • 25 comments

1.18 pre-2 update changed the required version to run the game. It now requires Java 17 instead of Java 16.

This is the error on the dashboard: mc-server Checking server JAR... Found a valid server file. It's called: paper.jar. Use ENABLE_UPDATE to update. mc-server Starting JAR file with: 3G of RAM mc-server Error: LinkageError occurred while loading main class net.minecraft.bundler.Main mc-server java.lang.UnsupportedClassVersionError: net/minecraft/bundler/Main has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 60.0

image

Do I need to update it manually or should I just wait?

MiniGPT avatar Nov 21 '21 10:11 MiniGPT

how to do this manually ? i tried use 'FROM openjdk:17-jdk-buster', but dont work @MiniGPT

JonasCardoso avatar Dec 01 '21 02:12 JonasCardoso

how to do this manually ? i tried use 'FROM openjdk:17-jdk-buster', but dont work @MiniGPT

Balena probably didn't release java 17, but I think that fabric 1.18 is using java 16 , maybe try using that version

MiniGPT avatar Dec 01 '21 08:12 MiniGPT

how to do this manually ? i tried use 'FROM openjdk:17-jdk-buster', but dont work @MiniGPT

Balena probably didn't release java 17, but I think that fabric 1.18 is using java 16 , maybe try using that version

I fixed the problem by doing a workaround to install jdk 17 with the mc-server script, works, but it's not ideal

JonasCardoso avatar Dec 01 '21 15:12 JonasCardoso

how to do this manually ? i tried use 'FROM openjdk:17-jdk-buster', but dont work @MiniGPT

Balena probably didn't release java 17, but I think that fabric 1.18 is using java 16 , maybe try using that version

I fixed the problem by doing a workaround to install jdk 17 with the mc-server script, works, but it's not ideal

How did you do that? I'd like to try as well.

stevereno30 avatar Dec 01 '21 20:12 stevereno30

how to do this manually ? i tried use 'FROM openjdk:17-jdk-buster', but dont work @MiniGPT

Balena probably didn't release java 17, but I think that fabric 1.18 is using java 16 , maybe try using that version

I fixed the problem by doing a workaround to install jdk 17 with the mc-server script, works, but it's not ideal

How did you do that? I'd like to try as well. put code below before java commands in mc-server/start.sh, works, but it's not ideal

curl -s "https://get.sdkman.io" | bash && source "$HOME/.sdkman/bin/sdkman-init.sh" && sdk install java 17.0.1-oracle

JonasCardoso avatar Dec 01 '21 21:12 JonasCardoso

how to do this manually ? i tried use 'FROM openjdk:17-jdk-buster', but dont work @MiniGPT

Balena probably didn't release java 17, but I think that fabric 1.18 is using java 16 , maybe try using that version

I fixed the problem by doing a workaround to install jdk 17 with the mc-server script, works, but it's not ideal

How did you do that? I'd like to try as well. put code below before java commands in mc-server/start.sh, works, but it's not ideal

curl -s "https://get.sdkman.io" | bash && source "$HOME/.sdkman/bin/sdkman-init.sh" && sdk install java 17.0.1-oracle

I tried running that command and got this error, any idea whats wrong?

image

Toastyisburning avatar Dec 02 '21 01:12 Toastyisburning

how to do this manually ? i tried use 'FROM openjdk:17-jdk-buster', but dont work @MiniGPT

Balena probably didn't release java 17, but I think that fabric 1.18 is using java 16 , maybe try using that version

I fixed the problem by doing a workaround to install jdk 17 with the mc-server script, works, but it's not ideal

How did you do that? I'd like to try as well. put code below before java commands in mc-server/start.sh, works, but it's not ideal

curl -s "https://get.sdkman.io" | bash && source "$HOME/.sdkman/bin/sdkman-init.sh" && sdk install java 17.0.1-oracle

I tried running that command and got this error, any idea whats wrong?

image

sorry, i forgot mention that need install the zip package put code bellow in mc-server/Dockerfile.template RUN install_packages wget jq zip

JonasCardoso avatar Dec 02 '21 01:12 JonasCardoso

Every time my machine restarts, it re-installs mc-server which over writes all changes to Dockerfile.template and start.sh. Any idea how I can disable this behavior?

stevereno30 avatar Dec 02 '21 12:12 stevereno30

Where do I find mc-server? via WinSCP I get only these directorys

image

te-ce avatar Dec 02 '21 17:12 te-ce

The actual serverfiles are located at /usr/src/serverfiles

mc-server, as referenced above, is the root directory you are looking at in that screenshot.

stevereno30 avatar Dec 02 '21 18:12 stevereno30

so in root should lay a Dockerfile.template ? I don't have one. Or should I just create it?

in usr/src is no serverfiles image

te-ce avatar Dec 02 '21 19:12 te-ce

how to do this manually ? i tried use 'FROM openjdk:17-jdk-buster', but dont work @MiniGPT

Balena probably didn't release java 17, but I think that fabric 1.18 is using java 16 , maybe try using that version

I fixed the problem by doing a workaround to install jdk 17 with the mc-server script, works, but it's not ideal

How did you do that? I'd like to try as well. put code below before java commands in mc-server/start.sh, works, but it's not ideal

curl -s "https://get.sdkman.io" | bash && source "$HOME/.sdkman/bin/sdkman-init.sh" && sdk install java 17.0.1-oracle

I tried running that command and got this error, any idea whats wrong? image

sorry, i forgot mention that need install the zip package put code bellow in mc-server/Dockerfile.template RUN install_packages wget jq zip

Every time the service is restarted, it reverts back to java 16 and no longer has zip or sdk installed. How can we make these changes persist through the service restart?

ctrl-alt-me avatar Dec 02 '21 20:12 ctrl-alt-me

you need deploy with theses changes from source

JonasCardoso avatar Dec 02 '21 20:12 JonasCardoso

you need deploy with theses changes from source

Are you referring to creating a new release in the source code and pushing it from the balena-cli? Or is there something else you mean by source?

ctrl-alt-me avatar Dec 02 '21 20:12 ctrl-alt-me

you need deploy with theses changes from source

Are you referring to creating a new release in the source code and pushing it from the balena-cli? Or is there something else you mean by source?

"creating a new release in the source code and pushing it from the balena-cli"

JonasCardoso avatar Dec 02 '21 20:12 JonasCardoso

After all, how can I install java17?

fogdog-twilight avatar Dec 03 '21 13:12 fogdog-twilight

After all, how can I install java17?

This is how I did it: Open mc-server from the balena dashboard terminal and enter these commands* one by one:

wget https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.1%2B12/OpenJDK17U-jdk_x64_linux_hotspot_17.0.1_12.tar.gz
tar xzf OpenJDK17U-jdk_x64_linux_hotspot_17.0.1_12.tar.gz
rm -rf /usr/local/openjdk-16
cp ./jdk-17.0.1+12 /usr/local/openjdk-16
wget https://papermc.io/api/v2/projects/paper/versions/1.18/builds/25/downloads/paper-1.18-25.jar
rm /usr/src/serverfiles/paper.jar
rm /usr/src/serverfiles/papersha256.txt
cp ./paper-1.18-25.jar /usr/src/serverfiles/paper.jar
echo '90606f2be5d5306a85febe016a84be6f081f544ff2085292fba9ec83b9cf31f4 paper.jar' > /usr/src/serverfiles/papersha256.txt

*This is what those commands do: 1) download java 17 from adoptium.net's github. 2) unpack downloaded tar.gz. 3) remove java 16. 4) move java 17 into the place that 16 was (the reason it is moved as "java 16" is because the start.sh file is looking for a directory named "openjdk-16"). 5) download most recent (as of 12/3/2021) paper.jar from papermc.io. 6) delete mc-server's paper.jar. 7) delete mc-server's sha256 file. 8) move downloaded paper.jar into place. 9) create new sha256 file for downloaded paper.jar.

Finally you must stop, then restart the mc-server service. Don't reboot, or this process will have to be repeated.

stevereno30 avatar Dec 03 '21 14:12 stevereno30

After all, how can I install java17?

This is how I did it: Open mc-server from the balena dashboard terminal and enter these commands* one by one:

wget https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.1%2B12/OpenJDK17U-jdk_x64_linux_hotspot_17.0.1_12.tar.gz
tar xzf OpenJDK17U-jdk_x64_linux_hotspot_17.0.1_12.tar.gz
rm -rf /usr/local/openjdk-16
cp ./jdk-17.0.1+12 /usr/local/openjdk-16
wget https://papermc.io/api/v2/projects/paper/versions/1.18/builds/25/downloads/paper-1.18-25.jar
rm /usr/src/serverfiles/paper.jar
rm /usr/src/serverfiles/papersha256.txt
cp ./paper-1.18-25.jar /usr/src/serverfiles/paper.jar
echo '90606f2be5d5306a85febe016a84be6f081f544ff2085292fba9ec83b9cf31f4 paper.jar' > /usr/src/serverfiles/papersha256.txt

*This is what those commands do: 1) download java 17 from adoptium.net's github. 2) unpack downloaded tar.gz. 3) remove java 16. 4) move java 17 into the place that 16 was (the reason it is moved as "java 16" is because the start.sh file is looking for a directory named "openjdk-16"). 5) download most recent (as of 12/3/2021) paper.jar from papermc.io. 6) delete mc-server's paper.jar. 7) delete mc-server's sha256 file. 8) move downloaded paper.jar into place. 9) create new sha256 file for downloaded paper.jar.

Finally you must stop, then restart the mc-server service. Don't reboot, or this process will have to be repeated.

It tells me is is a read only file system when i try to wget.

tom7351 avatar Dec 03 '21 21:12 tom7351

The host OS is read-only. You have to use the mc-server image

stevereno30 avatar Dec 03 '21 21:12 stevereno30

java 17 is still not installed.

In my environment, openjdk-16 not exist and "java --version" command is not available. But, balena console said "System Info: Java 16 (OpenJDK 64-Bit Server VM 16.0.1+9-24) Host: Linux 5.10.78-v8 (aarch64)"

fogdog-twilight avatar Dec 04 '21 01:12 fogdog-twilight