Jar executables that can directly start a NeoForge server
LGPL-2.1 License
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 theuser_jvm_args.txt
file will not be picked up by default. You'll need to runjava @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:
run.sh
(*nix) / run.bat
(Windows) filejava
invocation in the run script@[...]
)-jar
argument is found:
Class-Path
manifest entryjava.class.path
system property with the new entries-p
) argument, and load the jars on a new module layer, which will replace the boot layer--add-exports
/--add-opens
arguments and replicate them using Java instrumentation module redefinition--add-modules
arguments as they're irrelevant since the module path is fully loaded as the boot layer-D<name>=<value>
) specified by the args fileMain-Class
attribute of the jar / the first remaining argument the main class, load it, and retrieve its main(String[])
method