SOLUTION:
Prerequisite/Current Machine State:
Forge Server 12.2.2-14.23.5.2768-universal
macOS Mojave, Version 10.14.4
IMPORTANT, you must have a working server first, this is just a method for allocating more RAM to the pre-existing working server.
Step 1: Open TextEdit, click Format -> Make Plain Text
Step 2: Copy and paste this code in to the text file:
#!/bin/bash
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
cd "$(dirname "$0")"
exec Java -Xms16G -Xmx16G -jar forge-1.12.2-14.23.5.2768-universal.jar
Step 3: Replace "forge-1.12.2-14.23.5.2768-universal" , with the name of the file that you use to open your server normally.
Step 4: Now replace the "16" in "-Xms16G" "-Xmx16G" with the number of GB of RAM you would like to use. So if you want a server that uses 4GB of RAM you would use the following "-Xms4G -Xmx4G".
Step 5: Click File -> Save, replace "untitled" with "Start_Server.sh", then select to save the file in to the folder which has the server file in, this folder will also contain the eula.txt, server.properties and minecraft_server.1.12.2.jar.
Step 6: Open Terminal from the launchpad
Step 7: Drag and drop the file you just saved in to the terminal window, this should display a message like this "/User/dan/Documents/Start_Server.sh". Everything before "/Start_Server.sh" will probably be different to this example, this is not a problem as it just defines where the "Start_Server.sh" file is located on your machine.
The server should now start up, with the allocated RAM.
Note, do not close either the terminal or the Minecraft Server windows, type the word stop to close the server, then you can close the windows.
--------------------------------------------------------------------------
Troubleshooting:
If you are still getting this error code:
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(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) at net.minecraftforge.fml.relauncher.ServerLaunchWrapper.run(ServerLaunchWrapper.java:70) atnet.minecraftforge.fml.relauncher.ServerLaunchWrapper.main(ServerLaunchWrapper.java:34)Caused by: java.lang.ClassCastException: java.base/jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to java.base/java.net.URLClassLoader at net.minecraft.launchwrapper.Launch.<init>(Launch.java:34) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) ... 6 more
- Type this command in to the terminal window:
java -version
- The output may look like this:
java version "11.0.2" 2019-01-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)
-If it doesn't contain java version "1.8.0_211", issue this command:
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
-Now issue the "java -version" command again and the result should look like this:
java version "1.8.0_211"
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)
Once you have seen the message above on you terminal window, perform step 7 again.
Hope this helps :)