Say we have a config.properties file containing various configuration details. This file is placed under the resources folder and loaded using classpath. Then we can override the file during runtime by specifying a different file to the classpath command line argument. Let's say that the main class is Main.java inside com.example.test package and the test.jar is our program. Use the following command to override the config.properties file.

java -classpath .;test.jar;config.properties; com.example.test.Main