Minecraft server wont start after installing java 15 and switching to it from java 8

So I was running a minecraft server under java8 jre/jdk and it just worked fine. I had to install a newer version of jre/jdk because of university (IntelliJ IDEA). I tried to start the minecraft server because i wanted to play with my friends and it says:

A problem occurred running the Server launcher.java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at cpw.mods.fml.relauncher.ServerLaunchWrapper.run(ServerLaunchWrapper.java:48)
at cpw.mods.fml.relauncher.ServerLaunchWrapper.main(ServerLaunchWrapper.java:17)
Caused by: java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader ‘bootstrap’)
at net.minecraft.launchwrapper.Launch.(Launch.java:33)
at net.minecraft.launchwrapper.Launch.main(Launch.java:27)
… 6 more

The output of archlinux-java status is (i removed java 8 because i tought that i dont need it anymore):
Available Java environments:
java-15-openjdk (default)

And the output of java -version is:

openjdk version “15.0.2” 2021-01-19
OpenJDK Runtime Environment (build 15.0.2+7)
OpenJDK 64-Bit Server VM (build 15.0.2+7, mixed mode)

I would appreciate if some of you could help me.

Minecraft (and server software) only runs on Java 8:

“Starting from Minecraft 1.12, Java 8 will be required to run Minecraft. If you don’t know whether you have Java 8, don’t worry - our installers supply Minecraft with its own version of Java by default.”

1 Like

WTF

Forum gives me notification about a new thread… from 5 months ago?

//EDIT: ok I got it, first post has been edited, it notifies again… I also receive notification for ‘likes’ on my posts that already happened (‘likes’ number doesn’t change)