Using Java Properties File
Many programmers use properties files for keeping configuration parameters (DB Server IP etc.) Here is a sample class code for accessing configuration parameters from a properties file. You can pass JVM parameter like this : java -DMyPropertiesFile=/usr/local/java/proj/myconfig.properties MyClass package javacream; import java.io.InputStream; import java.util.Properties; public class AppProperties { private static Properties prop; static { initiate(); } protected static void initiate() { try { //Pass Java VM following arguement // -DMyPropertiesFile="[PATH]/[PROPERTIESFILENAME]" prop = new Properties(); String propertiesFile = System.getProperty("MyPropertiesFile"); if (propertiesFile == null) { System.out .println("Could not find content.properties property in System Properties."); System.out .println("This property file is needed for the application to operate."); System.out .println("Se...