flathub/org.prismlauncher.PrismLauncher

Bundled Java version causes issues

Closed this issue · 20 comments

The current bundled version is 1.8.0_345 but we need update 321 or lower for Forge to work properly. This is also documented on the Prism launcher website: https://prismlauncher.org/wiki/getting-started/installing-java/#forge-1.16.5-and-java-8u321+

I have no idea how to even bypass this, as giving all filesystem permissions via flatseal doesn't seem to work and any outside path is treated as /run/user/1000/ instead of the path I give it.

Oh. We still haven't updated the docs on the website. Switching to a newer Forge version should work fine

A random modpack I tried (FTB Academy 1.16 version 1.3.0) uses by default Forge version 36.2.22.

Trying some of the newer ones (36.2.34 since it has a pretty star next to it, but the latest 36.2.39 is broken in the same way too) gives me a new error:

SEVERE: Exception caught from launcher.
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.prismlauncher.impl.OneSixLauncher.invokeMain(OneSixLauncher.java:104)
	at org.prismlauncher.impl.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:176)
	at org.prismlauncher.impl.OneSixLauncher.launch(OneSixLauncher.java:186)
	at org.prismlauncher.EntryPoint.listen(EntryPoint.java:144)
	at org.prismlauncher.EntryPoint.main(EntryPoint.java:74)
Caused by: java.lang.NoClassDefFoundError: cpw/mods/modlauncher/Launcher
	at io.github.zekerzhayard.forgewrapper.installer.detector.IFileDetector.getLibraryDir(IFileDetector.java:55)
	at io.github.zekerzhayard.forgewrapper.installer.detector.MultiMCFileDetector.getLibraryDir(MultiMCFileDetector.java:24)
	at io.github.zekerzhayard.forgewrapper.installer.detector.MultiMCFileDetector.getInstallerJar(MultiMCFileDetector.java:33)
	at io.github.zekerzhayard.forgewrapper.installer.detector.IFileDetector.getDataFromInstaller(IFileDetector.java:120)
	at io.github.zekerzhayard.forgewrapper.installer.detector.IFileDetector.getInstallProfileExtraData(IFileDetector.java:115)
	at io.github.zekerzhayard.forgewrapper.installer.detector.IFileDetector.checkExtraFiles(IFileDetector.java:147)
	at io.github.zekerzhayard.forgewrapper.installer.Main.main(Main.java:29)
	... 9 more
Nov 03, 2022 1:07:09 PM org.prismlauncher.EntryPoint main```

Using the portable version, everything works perfectly fine.

For anyone stumbling upon this issue, you can simply install the correct Java version on Fedora with this command: sudo dnf install --releasever=35 --disablerepo=updates java-1.8.0-openjdk

This will give you version 302, not sure how old that is, but it works.

Seems like Flatpak is sandboxing a bit too well if I can't even use my system installation of Java no matter what I do, and believe me when I say I ticked everything in Flatseal to give it access to system libraries.

What even is the special /app/jdk path in this program?

You can try using Flatseal to allow the path to your custom JRE

I'm not sure how much more I can allow there
image

It's possible that Flatpak blacklists /usr. You could try narrowing down the path or putting a Java install at /opt for example. In either case putting it to the list of Persistent paths might cause issues

If you are on Fedora you could look at out COPR repo. Should be linked on the website on the Linux downloads page

I believe this problem is your packaging of this flatpak, you are bundling an imcompatible version of Java that cannot be overriden in any way, forcing users to use the AppImage or a .deb/.rpm.

Here, you are using org.freedesktop.Sdk.Extension.openjdk8 version 22.08 and as you can see, that uses a newer version of Java that breaks modpacks, as your own website warns about. I think the simplest solution would be shipping with the 19.08 version of said SDK, which should ship with java 8u222 which is lower than the problematic 8u321. Though a more proper solution would include changing how you bundle java entirely so you have better control over the version you include and don't have to skip 150 versions.

We can't mix and match newer and older versions here. The version for the extensions is determined by the SDK version of the flatpak

The proper solution if someone wants a custom JRE is to have it stored somewhere in your system where it won't interfere with Flatpak's sandboxing. Like /opt or somewhere in your home folder

Then this should definitely be mentioned, preferably in big red letters everywhere on this github, flathub and the website.

As it currently stands, the vast majority of modpacks won't work on this flatpak due to you shipping a version of java your own website considers broken.

I'm curious if this was ever tested, as not being able to play any 1.12 modpack is a serious issue.

As it currently stands, the vast majority of modpacks won't work on this flatpak

This is the only case I know of where a newer Forge version did not fix the problem. We have updated our docs to include these instructions: https://prismlauncher.org/wiki/overview/frequent-issues/#minecraft-1.16.5-with-minecraft-forge-and-java-8u321+

In any case, we won't ever ship outdated JREs as they are a security risk for a multiplayer game like Minecraft.

The proper solution if someone wants a custom JRE is to have it stored somewhere in your system where it won't interfere with Flatpak's sandboxing. Like /opt or somewhere in your home folder

Yes, that is the way for Flatpak. I've addressed how to do this with PolyMC in a previous comment. The process works, but is not very user-friendly.

Maybe in the future, Prism could have its own 'JRE downloader/manager'...

The proper solution if someone wants a custom JRE is to have it stored somewhere in your system where it won't interfere with Flatpak's sandboxing. Like /opt or somewhere in your home folder

The simplest solution is storing the JRE in the java folder in the data folder

I believe this problem is your packaging of this flatpak, you are bundling an imcompatible version of Java that cannot be overriden in any way, forcing users to use the AppImage or a .deb/.rpm.

Here, you are using org.freedesktop.Sdk.Extension.openjdk8 version 22.08 and as you can see, that uses a newer version of Java that breaks modpacks, as your own website warns about. I think the simplest solution would be shipping with the 19.08 version of said SDK, which should ship with java 8u222 which is lower than the problematic 8u321. Though a more proper solution would include changing how you bundle java entirely so you have better control over the version you include and don't have to skip 150 versions.

no, you can override it with flatseal, and just update forge for fixing modpacks

with 9.0 and java management released (not yet published to flathub) does this still persist or can this issue be closed?

@ZekeZDev I downloaded develop and built the Flatpak with this tweak (Edit: This tweak is no longer needed. The Flatpak manifest has been fixed to enable the Java downloader by default):

image

That made this appear:

image

This made Minecraft launch for me in PrismLauncher Flatpak for the first time ever. I have never been able to use PrismLauncher before.

Edit: The Mojang Java version is only working with Minecraft 1.21.3 (latest game release), the others give a java.lang.ClassNotFoundException: net.minecraft.client.main.Main, so maybe PrismLauncher downloads the wrong Mojang Java for older game versions. Either way it's working well for the latest game release.

Edit: My mistake apparently? I made a "new instance" with an older Minecraft but PrismLauncher does not automatically download it hehe. Clicking this button made older game instances work with the Mojang Java too. Apparently I always have to manually click it after creating a new instance. All is great now! Running Minecraft in PrismLauncher Flatpak. :)

image

Edit: For fun I installed Minecraft 1.20.1 (old) and it downloaded an older Mojang Java runner. So your automatic Java downloader is PERFECT. :)

@ZekeZDev I fixed your develop branch's Flatpak manifest and brought in a convenient script for building the Flatpak. Hope you can merge it soon, because your develop branch is way behind the Flathub manifest at the moment, and is lacking the Java Downloader. People will need these fixes to be able to enjoy Prism Launcher. :)

PrismLauncher/PrismLauncher#2980

Edit for those wondering: It's been merged.

@ZekeZDev I can confirm that this ticket can be closed as soon as Flathub has released a version of Prism Launcher with the new Mojang Java downloader enabled. I don't know if that's still only available in the develop branch that I'm using.

The downloader is enabled and worked in my testing. Closing this.