Say we have a 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 inside com.example.test package and the test.jar is our program. Use the following command to override the file.

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