I succeeded in launching Minecraft with a different Java executable. I followed a YouTube tutorial which I've linked in a spoiler below. It no longer gives me the "Internal Exception: java.io.IOException: An existing connection was forcibly closed by the remote host" anymore.
Instead it gives me the error message "Internet Exception: java.net.SocketException: Connection Reset"
I'll try new things and update this post as I go.
I have now confirmed that the issue also happens on other realms. It does not affect only one realm, but it still contained to only realms.
What have you tried?
Help is, as always, greatly appreciated. Thanks in advance, Qwitsch.
Spoiler includes previous thread.
Possibly Java related issue when connecting to a Realm.
I join a friends realm and get disconnected with the message "Internal Exception: java.io.IOException: An existing connection was forcibly closed by the remote host".
When does it happen?
After connecting to their realm I can usually play for a bit, ranging from half a second to a few minutes, before I get disconnected.
It does not happen when I join public servers, like Hypixel or Wynncraft.
I have not tested if it also happens on other realms, as I have none to test it with.
The issue existed in both version 1.15.2 and 1.16.1.
What have you tried?
I have tried: All of this was done with a pure vanilla profile.
Restarting PC. The issue has been around since late may so I've turned my pc off and on a lot of times in the period.
Restarting Minecraft. This did and does nothing noticeable.
Restarting my router. This let me play for around half an hour, but then it disconnected me again.
Reinstalling Minecraft. I tried installing the .exe version of the launcher, but that did not work either.
Changed the world on the realm. The realm owner changed the world of the realm to an entirely new one, but that hasn't changed anything about the issue at hand.
Flushing my DNS Cache. I have no clue what this means, but another thread made by someone who seems to have had the same issue recommended it. This did not fix the issue.
Clearing my Minecraft directory, or the .minecraft folder. I backed up all the files in my .minecraft folder and cleared it. Starting Minecraft with an empty directory didn't help though.
Using Badlion Client instead of vanilla minecraft. Still the same issue.
Allowing Java through my firewall. I have allowed it access to both public and private networks, which doesn't seem to have changed anything.
Enabling Native Sandbox. I followed this guide to enable the native sandbox, which didn't help either.
Start Minecraft with a different Java executable. I have tried doing this but to no avail. I downloaded the newest version of Java from Oracle's website. Located the javaw.exe file and edited my profile to launch from that instead of the bundled Java runtime. The game crashes instantly when starting.
Help with new solutions or getting the different Java executable to work would be greatly appreciated. I'm willing to try most things. I've probably tried some things I didn't list here as I forgot about doing them.
Edit: Added more things to the list of things I have tried.