Jump to content

Recommended Posts

Posted (edited)

Hi,

 

Forge server 12.2

Mac OS

 

I currently have a forge server up and running with mods on my MAC. Everything is working fine a but it is quite laggy. When I lunch my forge server.jar file seems to default to only using 1GB RAM. I tried to follow the same principle of changing the allocation in windows, however the Mac equivalent doesn't seem to work. This is the script file I used to call the the forge sever file:

 

#!/bin/bash
cd "$(dirname "$0")"
exec java -Xms1G -Xmx1G -jar forgeserver.jar nogui
 

That returns this error:

 

 

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

 

 

My troubleshooting:

The scrip points to the correct file name

All files have sufficient permissions

The script is running in the same folder as the forge sever file

I can launch the server by clicking on the server file and it works like normal (with the 1GB allocation)

 

I know this is almost certainly a MAC/scripting issue but someone may have had a similar problem. 

 

Thanks in advance

 

Edited by cheese_the_acid
Typo
Posted (edited)

Currently running Java 8 update 211, still getting the same problem as before unfortunately. The error code has changed slightly tho :

 

 
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:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
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)
... 6 more
 
Thanks

 

 

Edited by cheese_the_acid
Added thanks
Posted

You're not running Java 8, you may have it installed but your computer is trying to use a different version.

This is my Forum Signature, I am currently attempting to transform it into a small guide for fixing easier issues using spoiler blocks to keep things tidy.

 

As the most common issue I feel I should put this outside the main bulk:

The only official source for Forge is https://files.minecraftforge.net, and the only site I trust for getting mods is CurseForge.

If you use any site other than these, please take a look at the StopModReposts project and install their browser extension, I would also advise running a virus scan.

 

For players asking for assistance with Forge please expand the spoiler below and read the appropriate section(s) in its/their entirety.

  Reveal hidden contents

 

Posted

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 :)

  • 8 months later...
Posted

I cant find a fix for this

 

0210005s-iMac:~ a0210005$ /Users/a0210005/Desktop/Youtube\ Modded\ Ugreilah\ Series/Start_Server.sh 

-bash: /Users/a0210005/Desktop/Youtube Modded Ugreilah Series/Start_Server.sh: Permission denied

  • Guest locked this topic
Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.