ServerStarterJar is a same-process wrapper around the Forge (1.17+) and NeoForge server run scripts.
This project brings back the server.jar
file in old versions, that can be used when a server host does not support custom launch scripts (such as the run.sh
file).
To use the starter, simply download the server.jar
file of the latest release
and place it in the folder the run.sh
/run.bat
scripts are located (you may need to run the NeoForge installer first with the --install-server
argument; check the installer section for more information).
Afterwards, you may run the jar as an executable (i.e. java -jar server.jar
).
Important
Any JVM arguments (such as -Xmx
) placed in the user_jvm_args.txt
file will not be picked up by default. You'll need to run java @user_jvm_args.txt -jar server.jar
.
This starter is compatible with all MinecraftForge versions since 1.17, and with all NeoForge versions.
If the starter cannot find the run scripts, it will attempt to run an installer.
It will first try to run the first file ending with -installer.jar
from the folder.
You may specify an installer to download instead using the --installer
option (i.e. java -jar server.jar --installer 21.0.46-beta
).
The installer specified can either be a link to an installer (i.e. https://maven.neoforged.net/releases/net/neoforged/neoforge/21.0.46-beta/neoforge-21.0.46-beta-installer.jar
)
or a NeoForge version to download the installer for (i.e. 21.0.46-beta
).
Note
The installer will only be run if the starter cannot find the run scripts. You may force it to run if the installer version and the installed version differ using --installer-force
.
Below you will find the steps the start goes through to launch a modular NeoForge environment:
- search the folder the starter was invoked in for the
run.sh
(*nix) /run.bat
(Windows) file - find the
java
invocation in the run script - extract and parse any argument file references (
@[...]
) - if a
-jar
argument is found:- put it on the system classpath alongside all entries specified in the
Class-Path
manifest entry - update the
java.class.path
system property with the new entries
- put it on the system classpath alongside all entries specified in the
- otherwise
- parse the module path (
-p
) argument, and load the jars on a new module layer, which will replace the boot layer - parse the
--add-exports
/--add-opens
arguments and replicate them using Java instrumentation module redefinition - ignore the
--add-modules
arguments as they're irrelevant since the module path is fully loaded as the boot layer
- parse the module path (
- set the system properties (
-D<name>=<value>
) specified by the args file - consider the
Main-Class
attribute of the jar / the first remaining argument the main class, load it, and retrieve itsmain(String[])
method - append any arguments specified to the starter executable to the remaining arguments 9
- launch Minecraft with the remaining arguments