Skip to content

Custom server files cannot run because of overwritten, badly formatted JAVA_ARGS #3990

@khatharsis42

Description

@khatharsis42

Describe the problem

When trying to run to server files ( which is the recommended way to run most modpacks ), the JAVA_ARGS variable in variables.txt will get overwritten with the values " -Xmx8G -Xms8G ". Do note the space at the beginning, and the two spaces at the end. These spaces are the sources of issues latter down the line, where Java doesn't recognize them as proper arguments:

I believe this is because this docker file automatically regenerates a user_jvm_args.txt, which is then read by some startup scripts and causes these issues. There should thus be an option to disable this autogeneration.

Container definition

services:
  mc:
    image: itzg/minecraft-server:latest
    tty: true
    stdin_open: true
    ports:
      - "25565:25565"
    environment:
      EULA: "TRUE"
      MODPACK_PLATFORM: "CURSEFORGE"
      MEMORY: '8G'
      CF_SERVER_MOD: '/downloads/Submerged_2_server_pack_1.0.zip'

Container logs

 [init] Running as uid=1000 gid=1000 with /data as 'drwxr-xr-x 3 1000 1000 4096 Mar 26 13:24 /data'
 [init] Image info: buildtime=2025-08-04T11:51:11.973Z,version=java21,revision=a569d63cf313abd8feb0ecb60447101248cfbf12
 [init] Autopause functionality enabled
 [init] [WARN] For the old TYPE=CURSEFORGE mechanism it is best to set VERSION to a specific value 
 [init] Resolved version given LATEST into 26.1
 [init] Looking for Feed-The-Beast / CurseForge server modpack.
 [init] Copying any mods from /mods to /data/mods
 [init] Copying any configs from /config to /data/config
 [init] detected FTB, changing properties path to /data/FeedTheBeast/server.properties
 [init] Enabling whitelist functionality
 [mc-image-helper] 13:31:06.223 INFO  : Created/updated 1 property in /data/FeedTheBeast/server.properties
 [init] Setting initial memory to 8G and max to 8G
 [init] Running FTB /data/FeedTheBeast/start.sh in /data/FeedTheBeast ...
 Start script generated by ServerPackCreator 7.3.0.
 To change the launch settings of this server, such as JVM args / flags, Minecraft version, modloader version etc., edit the variables.txt-file.
 
 Running NeoForge checks and setup...
 Generating user_jvm_args.txt from variables...
 Edit JAVA_ARGS in your variables.txt. Do not edit user_jvm_args.txt directly!
 Manually made changes to user_jvm_args.txt will be lost in the nether!
 server.jar could not be found.
 Downloading server.jar
 from https://github.com/neoforged/ServerStarterJar/releases/latest/download/server.jar
######################################################################## 100.0% 
 Download complete.
Starting server...
 Minecraft version:              1.21.1
 Modloader:                      NeoForge
 Modloader version:              21.1.220
 LegacyFabric Installer Version: 1.1.1
 Fabric Installer Version:       1.1.1
 Quilt Installer Version:        0.12.1
 Java Args:                       -Xmx8G -Xms8G  
 Additional Args:                -Dlog4j2.formatMsgNoLookups=true
 Java Path:                      java
 Wait For User Input:            true
 Run Command:       java -Dlog4j2.formatMsgNoLookups=true @user_jvm_args.txt -Dfml.queryResult=confirm -jar server.jar --installer-force --installer 21.1.220 nogui
 Java version:
 openjdk version "21.0.7" 2025-04-15 LTS
 OpenJDK Runtime Environment Temurin-21.0.7+6 (build 21.0.7+6-LTS)
 OpenJDK 64-Bit Server VM Temurin-21.0.7+6 (build 21.0.7+6-LTS, mixed mode, sharing)
 
 Exception in thread "main" java.lang.Exception: Failed to find main class " -Xmx8G"
     at net.neoforged.serverstarterjar.Main.mainLaunch(Main.java:285)
     at net.neoforged.serverstarterjar.Main.main(Main.java:76)
     at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)
     at java.base/java.lang.reflect.Method.invoke(Unknown Source)
     at net.neoforged.serverstarterjar.Main8.main(Main8.java:19)
 Caused by: java.lang.ClassNotFoundException:  -Xmx8G
     at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
     at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
     at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
     at java.base/java.lang.Class.forName0(Native Method)
     at java.base/java.lang.Class.forName(Unknown Source)
     at java.base/java.lang.Class.forName(Unknown Source)
     at net.neoforged.serverstarterjar.Main.mainLaunch(Main.java:283)
     ... 4 more

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions