When software application is delivered or deployed on customer site then for each customer there is different setting.
Some architect use Database , Properties file or Some other method.
Here I am going to demo you how to use properties file.
Create General project in jdeveloper as below.
- Create Java File to read properties
- Create properties file in resource directory
Enter following content in properties file.
Write following java code and Run.
import java.io.IOException;import java.io.InputStream;import java.util.Properties;public class LoadProperties {public static void main(String[] args) throws IOException {Properties props = new Properties();InputStream st =Thread.currentThread().getContextClassLoader().getResourceAsStream("MyApp.properties");props.load(st);System.out.println(props.getProperty("CUST_CURRENCY"));System.out.println(props.getProperty("CUST_LANG"));System.out.println(props.getProperty("CUST_CITY"));}}
A good concise reference.. thanks
ReplyDeleteAppreciate ! , I get very less time to reply to comments.
ReplyDelete