Problems creating a start.command file

Ok so since sponge disables the default minecraft GUI I was trying to script a shell that would execute the server in terminal. After fixing the permissions I still encounter an error which I believe is caused by my default java version. Pretty sure I need to be on 8 not 11. This is the output I get every time I run the start.command. Does anyone know how to fix this? Possibly how to switch default java versions on Mac?

A problem occurred running the Server

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(

at java.base/java.lang.reflect.Method.invoke(


at net.minecraftforge.fml.relauncher.ServerLaunchWrapper.main(

Caused by: java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class (jdk.internal.loader.ClassLoaders$AppClassLoader and are in module java.base of loader ‘bootstrap’)

at net.minecraft.launchwrapper.Launch.(

at net.minecraft.launchwrapper.Launch.main(

… 6 more


Saving session…

…copying shared history…

…saving history…truncating history files…


[Process completed]

Yep thats the not java 8 error.

When it comes to what application get the command for any application on mac, windows or linux, its based upon what the command shell can access first. It typically searches your current folder for a application called java, failing that it will use the path system.

So you have two options. The first is to change the Java_Home variable which is the path to the java application. Currently it will be set to the java 11, if you change it to the Java 8 location that will change the java command to 8.

The other option is one I have only used in windows, not Linux nor Mac and that it running the specific java application though the shell. In windows you did this by replacing ‘java’ in the command to “'Path_to_java”’ (in quotes). This has the advantage that you only need to do it once (you only need to do the other way one if you dont need java 11)