0

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.

2
  • You should post the code where the properties file is being loaded. Your question is too vague otherwise Commented Oct 7, 2013 at 6:03
  • 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 m using the file in this method of my application,but i m trying to provide this file through my script. Commented Oct 7, 2013 at 6:11

1 Answer 1

1

you have a typo in your shell invocation you are using -Doligosoft.POSconfig.file=... instead of -Doligosoft.POSConfig.file=...

Sign up to request clarification or add additional context in comments.

2 Comments

i cant understand can u please elaborate.
you need to have capital C in POSConfig instead of POSconfig

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.