To achieve this, you need to ensure that the config directory is added to the classpath and that the lib directory is included for additional JARs. Here is how you can do it:
java -cp "MyApp.jar:lib/*" -Dspring.config.location=./config/application.properties org.springframework.boot.loader.JarLauncher