I have created a shell script to run my project in Ubuntu. There I had to give the properties file path along with the Java command.
I'm using this command to do so but its not working the file is not loading and it is giving NullPointerException as I'm trying to use it.
/usr/lib/jvm/java-7-openjdk-i386/bin/java" -cp $CLASSPATH -Doligosoft.POSconfig.file=/home/mlpc04/Paritosh/POS_3.0/resources/posconfig.properties com.floreantpos.main.Main
In the Classpath I had given properly the location where this file is located but don't know what is going wrong please suggest me the command I'm using is correct or the problem is something else.
EDIT
private static void loadPosConfig() { String filename = System.getProperty( "oligosoft.POSConfig.file" ); posConfig = new Properties(); System.out.println(filename); File file = new File(filename); System.out.println( file.getAbsolutePath()); FileInputStream inputStream = null; try { inputStream = new FileInputStream( file ); posConfig.load(inputStream); } catch ( Exception e) { logger.error( "Not able to load configuration" , e ); } I am using the file in this method of my application,but i m trying to provide this file through my script.