Jump to content

MAC Server RAM allocation


Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Spoiler

Logs (Most issues require logs to diagnose):

Spoiler

Please post logs using one of the following sites (Thank you Lumber Wizard for the list):

https://gist.github.com/100MB Requires member (Free)

https://pastebin.com/: 512KB as guest, 10MB as Pro ($$$)

https://hastebin.com/: 400KB

Do NOT use sites like Mediafire, Dropbox, OneDrive, Google Drive, or a site that has a countdown before offering downloads.

 

What to provide:

...for Crashes and Runtime issues:

Minecraft 1.14.4 and newer:

Post debug.log

Older versions:

Please update...

 

...for Installer Issues:

Post your installer log, found in the same place you ran the installer

This log will be called either installer.log or named the same as the installer but with .log on the end

Note for Windows users:

Windows hides file extensions by default so the installer may appear without the .jar extension then when the .log is added the log will appear with the .jar extension

 

Where to get it:

Mojang Launcher: When using the Mojang launcher debug.log is found in .minecraft\logs.

 

Curse/Overwolf: If you are using the Curse Launcher, their configurations break Forge's log settings, fortunately there is an easier workaround than I originally thought, this works even with Curse's installation of the Minecraft launcher as long as it is not launched THROUGH Twitch:

Spoiler
  1. Make sure you have the correct version of Forge installed (some packs are heavily dependent on one specific build of Forge)
  2. Make a launcher profile targeting this version of Forge.
  3. Set the launcher profile's GameDir property to the pack's instance folder (not the instances folder, the folder that has the pack's name on it).
  4. Now launch the pack through that profile and follow the "Mojang Launcher" instructions above.

Video:

Spoiler

 

 

 

or alternately, 

 

Fallback ("No logs are generated"):

If you don't see logs generated in the usual place, provide the launcher_log.txt from .minecraft

 

Server Not Starting:

Spoiler

If your server does not start or a command window appears and immediately goes away, run the jar manually and provide the output.

 

Reporting Illegal/Inappropriate Adfocus Ads:

Spoiler

Get a screenshot of the URL bar or copy/paste the whole URL into a thread on the General Discussion board with a description of the Ad.

Lex will need the Ad ID contained in that URL to report it to Adfocus' support team.

 

Posting your mod as a GitHub Repo:

Spoiler

When you have an issue with your mod the most helpful thing you can do when asking for help is to provide your code to those helping you. The most convenient way to do this is via GitHub or another source control hub.

When setting up a GitHub Repo it might seem easy to just upload everything, however this method has the potential for mistakes that could lead to trouble later on, it is recommended to use a Git client or to get comfortable with the Git command line. The following instructions will use the Git Command Line and as such they assume you already have it installed and that you have created a repository.

 

  1. Open a command prompt (CMD, Powershell, Terminal, etc).
  2. Navigate to the folder you extracted Forge’s MDK to (the one that had all the licenses in).
  3. Run the following commands:
    1. git init
    2. git remote add origin [Your Repository's URL]
      • In the case of GitHub it should look like: https://GitHub.com/[Your Username]/[Repo Name].git
    3. git fetch
    4. git checkout --track origin/master
    5. git stage *
    6. git commit -m "[Your commit message]"
    7. git push
  4. Navigate to GitHub and you should now see most of the files.
    • note that it is intentional that some are not synced with GitHub and this is done with the (hidden) .gitignore file that Forge’s MDK has provided (hence the strictness on which folder git init is run from)
  5. Now you can share your GitHub link with those who you are asking for help.

[Workaround line, please ignore]

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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


×
×
  • Create New...

Important Information

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