Minecraft with Forge won´t work

OS Name/Version: Ubuntu 22.04.1 LTS

Product Name/Version: AMP Release “Halimede” v2.4.0.2,

Problem Description:

Created a new Instance for a Minecraft Server with mods.
I changed the Server type to Forge and selected the Forge Version
When i tried to start, i got these errors in the console and the wouldnt start.

A problem occurred running the Server launcher.java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:110)
at java.base/java.lang.reflect.Method.invoke(Method.java:577)
at net.minecraftforge.fml.relauncher.ServerLaunchWrapper.run(ServerLaunchWrapper.java:70)
at net.minecraftforge.fml.relauncher.ServerLaunchWrapper.main(ServerLaunchWrapper.java:34)
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.<init>(Launch.java:34)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
... 3 more

Steps to reproduce:

  • Create new Instance for Minecraft forge.
  • Change forge Version and update.
  • Start server.

Actions taken to resolve so far:
I dont have any ideas what to do, I am new to Ubuntu.

You might need to adjust the Java version used. Old versions of forge need Java 8, newer ones use the latest. Use AMPs search box and type “Java Version” to jump to the setting.

I only got 4 Version in the box to choose from. 11,17,18 and default-java. Tried all Versions, doesn’t change the issue, just the console output varies the numbers. Do I need to search for a line to put in additional java options to use another Java version?

Run bash <(wget -qO- getamp.sh) installJava as root then restart AMP.