package propertyfile;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
public class ReadPropertyFile {
public ReadPropertyFile() {
super();
}
public static void main(String args []){
try {
File file = new File("/opt/oracle/urls/test.properties");
FileInputStream fileInputStream = new FileInputStream(file);
ResourceBundle bundle =new PropertyResourceBundle(fileInputStream);
String appURL = bundle.getString("googleRedirectURL");
System.out.println(appURL);
fileInputStream.close();
} catch (FileNotFoundException fnfe) {
// TODO: Add catch code
fnfe.printStackTrace();
} catch (IOException ioe) {
// TODO: Add catch code
ioe.printStackTrace();
}
}
}
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
public class ReadPropertyFile {
public ReadPropertyFile() {
super();
}
public static void main(String args []){
try {
File file = new File("/opt/oracle/urls/test.properties");
FileInputStream fileInputStream = new FileInputStream(file);
ResourceBundle bundle =new PropertyResourceBundle(fileInputStream);
String appURL = bundle.getString("googleRedirectURL");
System.out.println(appURL);
fileInputStream.close();
} catch (FileNotFoundException fnfe) {
// TODO: Add catch code
fnfe.printStackTrace();
} catch (IOException ioe) {
// TODO: Add catch code
ioe.printStackTrace();
}
}
}
File location : /opt/oracle/urls/test.properties (C:\opt\oracle\urls)
property/variable : googleRedirectURL
Comments
Post a Comment