When running a Java JAR, you’ll often want to pass some command line arguments. In the below example, an argument is being used to set the port the application runs on.

java -jar myapp.jar -Dserver.port=7428

However, this won’t work, because the arguments were passed in after the -jar myapp.jar part.

Switching the arguments around fixes this:

java -Dserver.port=7428 -jar myapp.jar

So, if it ever seems like one of your properties isn’t being picked up, check the arguments just in case.