How to add java args *after* the "java -jar minecraft.jar"?

I’m clearly missing something, I just can’t quite seem to nail it down. The MineOS GUI provides a java_tweaks field, whose values are added to the command line, in front of the “java -jar …”

For example, I’m using “-Dlog4j.configurationFile=log4j2.xml”, which then is translated to:

/usr/bin/java -server -Xmx1536M -Xms1536M -Dlog4j.configurationFile=log4j2.xml -jar /var/games/minecraft/servers/mcserver/minecraft.jar"

What I want to do is add “–forceUpgrade” and possibly “-nogui”, so that they appear at the very end, like this:
/usr/bin/java -server -Xmx1536M -Xms1536M -Dlog4j.configurationFile=log4j2.xml -jar /var/games/minecraft/servers/mcserver/minecraft.jar --forceUpgrade"

I want to add these options to the very end, because otherwise those options cause the server to not start at all.

The GUI doesn’t seem to let you specify this, and editing the server.config directly doesn’t seem to change the behavior. What am I missing here?

Isn’t what you’re asking for the effects of the “Additional Jar Arguments field?”

So if you fill in:

Additional Java arguments: “-passedToJava”
Additional Jar arguments: “nogui”

then the resulting invocation should look like:

$ ./mineos_console.js -s asdf get_start_args
[asdf] Successfully executed "get_start_args"
[ '-dmS',
  'mc-asdf',
  '/usr/bin/java',
  '-server',
  '-Xmx512M',
  '-Xms512M',
  '-passedToJava',
  '-jar',
  'minecraft_server.1.15.1.jar',
  'nogui' ]

This is how I normally add nogui to the vanilla jarfile, but note it’s also nogui not -nogui.

$ cat server.config 
[java]
java_xmx=512
java_tweaks=-passedToJava
jar_args=nogui
jarfile=minecraft_server.1.15.1.jar
...

I’m just speculating, but I believe the leading hyphen - might even force arguments to be parsed by java rather than as an argument to -jar. If this is the case, it would explain why vanilla minecraft pushes simply nogui.

Hi Hexparrot,

Sorry for the delay in replying - I don’t have a “Additional Jar Arguments” field in either the server.config or server.properties page. I’m running 0.6.0, webui version 6d714d1. I tried updating, but the instructions ( https://minecraft.codeemo.com/mineoswiki/index.php?title=Updating_the_Webui ) don’t seem to change anything.

These are the fields I have available on the server.config page:

profile
java_tweaks
java_xmx
java_xms
start
restart_interval
archive_interval
backup_interval

Oh, you’re using the python-based webui, which hasn’t been meaningfully updated in 6 years, when it was superseded by the node.js webui.

I’ll start by saying, man, I’m thrilled that the python version lasted as long as it has, for you.

I’m reluctant, of course, to change the python codebase at this point in time, but it wouldn’t be impossible to make changes here in this line of mineos.py, adding in the values you want.

If you want it on a server-by-server basis, though, you’re probably looking at a change like this:

'jar_args': self.server_config['java':'jar_args':'']

Then you need to add:

[java]
jar_args=

to all your server.properties files. Should work pretty cleanly.

Thank you very much!

I don’t know why I was still using MineOS in that way - I built this new server in August 2018, and I think I just copied the installation steps from the original old server I built in … 2012? Anyway, I’m not going to hold on to the old.

I moved /usr/games/minecraft aside, and ran through the install instructions at https://minecraft.codeemo.com/mineoswiki/index.php?title=MineOS-node_(apt-get) - I had to run /usr/games/reset_webui.sh to make the web interface functional.

Now I will learn the “new” interface and also see how to adapt my admin scripts to the new utilities, as they called mineos_console.py, which is gone.

Thank you, again!

mineos_console.js is the alternative! Pretty much all the options plus more is available in this version, so feel free to reach out to us in a new thread if you have any questions about porting your scripts.