Griefed / ServerPackCreator

Create a server pack from a Minecraft Forge, NeoForge, Fabric, LegacyFabric or Quilt modpack!
https://serverpackcreator.de
GNU Lesser General Public License v2.1
187 stars 10 forks source link

[Improvement]: Recommend/Warn Java 8 for older Minecraft versions in script #479

Closed kreezxil closed 1 month ago

kreezxil commented 10 months ago

What happened?

Now that Minecraft and server pack creator are well beyond the Java 8 packs, especially 1.12.2, we have an interesting issue happening.

Most users have a newer than java 8 install on their systems. If they try run install.sh or .ps1 using the not java 8 java the libaries folder will fail to extract.

This was pointed out to me with my https://www.curseforge.com/minecraft/modpacks/world-of-dragons server pack. Took a fair bit to understand what was happening.

Since I"m pack and on again off again mod dev, i naturally have a lot of javas on hand so, once I told variables text to use java8 (that's what i called my java 8 binary), the library extracted.

What did you expect to happen?

Through no fault of SPC, I did kind of expect the installer script to actually extract libraries folder, but thinking about it ... I think I'd want it to tell the user that it expects a different version of java to do its thing. this may be too much to ask for and yes I know as each day marches on, less and less do we see java 8 servers running.

Version

4.3.2 and 5.0.0-beta.10

Relevant log output

log captured from the console, there is some kind of socket except when using java 17 and the libraries refuse to extract from the java 8 compiled jar.

https://paste.centos.org/view/6b1f66a1

variables.txt: https://paste.centos.org/view/412df769

variables.txt (**but now it points to my java 8 binary**): https://paste.centos.org/view/2bbf5aea

The now functioning log: https://paste.centos.org/view/fd5798ad

Anything else you would like to add?

Keep up the good work, and I'm not holing my breath as stated above.

If you are using the webservice, in which browers did you encounter this bug?

No response

Code of Conduct

Griefed commented 10 months ago

Heya Kreezxil,

ohhhh so now we have the reverse situation at hand, did I understand that correctly? Whereas before we have people trying to run newer packs with older Java versions, people are now trying to run older packs with newer Java versions?

Griefed commented 10 months ago

Related to this: https://github.com/Griefed/ServerPackCreator/issues/445 The aforementioned issue talks about people running server packs with older Java versions and whether we have a way to capture / check / prevent and maybe inform the user in an easy-to-understand way.

kreezxil commented 10 months ago

Yes, apparently this is the UNO reverse card.

Griefed commented 5 months ago

Heya Kreezxil,

if I remember correctly, you usually have multiple Java installations available on your machine. I'd like some feedback from people's environments other than my own (sanity check). Could you run the following command and post the return from it here?

which -a java | xargs -I{} echo "echo {};{} -version;echo" | sh

It should list all Java installations available in the system path and print their versions. Trying to determine whether that would be a viable way to discover available Java installations in a bash-script.

Cheers

kreezxil commented 5 months ago

I've actually done a Linux reset since talking about that, because I experimented way too much, however, I have java in two locations and your command produced the following output.

/usr/bin/java
openjdk version "17.0.10" 2024-01-16
OpenJDK Runtime Environment (build 17.0.10+7)
OpenJDK 64-Bit Server VM (build 17.0.10+7, mixed mode)

/usr/lib/jvm/default/bin/java
openjdk version "17.0.10" 2024-01-16
OpenJDK Runtime Environment (build 17.0.10+7)
OpenJDK 64-Bit Server VM (build 17.0.10+7, mixed mode)
Griefed commented 5 months ago

Thanks for the feedback. That looks like the command found the symlink (1st one) as well as the actual installation (2nd one).

I'll run some more tests on my end soonish.

kreezxil commented 5 months ago

I responded too quick, I check my /usr/lib/jvm and it did not detect my other installations of Java 8 and Java 22.

Griefed commented 3 months ago

Java checks are available as of https://github.com/Griefed/ServerPackCreator/releases/tag/6.0.0-alpha.3

Checks are based on the info from MultiMC and the info Chorb posted somewhere, as in MC 1.16 and older can use Java 8 and 11, everything else has a "minimum required" check.

This should aleviate at least a portion of problems on the users side for their Java version.

Griefed commented 2 months ago

Check out the latest alpha build: https://github.com/Griefed/ServerPackCreator/releases/tag/6.0.0-alpha.11

It not only has Java compatibility checks, which were added in alpha 3, but also automated Java installation based on the Java version recommended by Mojang themselves.

I'd appreciate some tests on this. :)

Griefed commented 1 month ago

Available as of 6.0.0