I would like to load properties file via command prompt in java.
Properties file name: project.properties
java -classpath .;test.jar; com.project.Main
What 'll be the command if I'll load the properties files via command prompt.
Thank in advance.
I have executed the below mentioned command on command prompt but not get any output.
java -classpath .;test.jar; -DPROP_FILE="C:\Program Files\DemoApp\config\project.properties" com.project.Main
Send file path as below format,
java -classpath .;test.jar; -DPROP_FILE=conf\project.properties com.project.Main
Use below code for getting property file
String propFile = System.getProperty("PROP_FILE");
Properties props = new Properties();
props.load(new FileInputStream(propFile));
Thanks.