Example usage for java.util Properties getProperty

List of usage examples for java.util Properties getProperty

Introduction

In this page you can find the example usage for java.util Properties getProperty.

Prototype

public String getProperty(String key) 

Source Link

Document

Searches for the property with the specified key in this property list.

Usage

From source file:Main.java

public static void main(String[] args) {
    Properties properties = System.getProperties();

    String pathSeparator = properties.getProperty("path.separator");
    System.out.println("pathSeparator = " + pathSeparator);
}

From source file:Load.java

public static void main(String args[]) throws Exception {
    Properties p = new Properties();
    p.load(new FileInputStream("colon.txt"));
    p.getProperty("foo");
}

From source file:Main.java

public static void main(String[] args) {
    Properties properties = new Properties();

    String dataFolder = properties.getProperty("data.folder");
    System.out.println("dataFolder = " + dataFolder);
    String jdbcUrl = properties.getProperty("jdbc.url");
    System.out.println("jdbcUrl = " + jdbcUrl);

}

From source file:com.mulodo.hadoop.wordcount.Application.java

public static void main(String[] args) throws IOException {

    Resource resource = new ClassPathResource("application.properties");
    Properties props = PropertiesLoaderUtils.loadProperties(resource);

    System.out.println(props.getProperty("spring.hadoop.fsUri"));
    System.out.println(props.getProperty("spring.hadoop.resourceManagerHost"));
    System.out.println(props.getProperty("spring.hadoop.jobHistoryAddress"));

    SpringApplication.run(Application.class, args);
}

From source file:com.wipro.ats.bdre.datagen.GeneratorMain.java

public static void main(String[] args) throws Exception {
    CommandLine commandLine = new GeneratorMain().getCommandLine(args, PARAMS_STRUCTURE);
    String processId = commandLine.getOptionValue("sub-process-id");

    GetProperties getProperties = new GetProperties();
    java.util.Properties listForParams = getProperties.getProperties(processId, "table");
    String outputDir = listForParams.getProperty("outputPath");

    String[] params = new String[] { processId, outputDir };
    int res = ToolRunner.run(new Configuration(), new Driver(), params);
    if (res != 0)
        throw new BDREException("Hive Generator error");

}

From source file:MainClass.java

public static void main(String args[]) {
    Properties prop = new Properties();
    prop.put("a", "1");
    prop.put("b", "2");
    prop.put("c", "3");
    Properties book = new Properties(prop);
    book.put("A", "4");
    book.put("B", "5");

    System.out.println("a " + book.getProperty("a"));
    System.out.println("A " + book.getProperty("b"));
    System.out.println("c: " + book.getProperty("c"));

    System.out.println("z: " + book.getProperty("z", "default"));
}

From source file:Main.java

  public static void main(String[] args) throws Exception {
  Properties prop = new Properties();
  String fileName = "app.config";
  InputStream is = new FileInputStream(fileName);

  prop.load(is);//from   w w w  .  ja v  a  2 s.  c  om

  System.out.println(prop.getProperty("app.name"));
  System.out.println(prop.getProperty("app.version"));

  System.out.println(prop.getProperty("app.vendor", "Java"));
}

From source file:com.magnet.mmx.util.DatabaseExport.java

public static void main(String[] args) throws Exception {
    InputStream inputStream = DeviceDAOImplTest.class.getResourceAsStream("/test.properties");

    Properties testProperties = new Properties();
    testProperties.load(inputStream);//w  w w  .  j  a  v  a 2s . c  om

    String host = testProperties.getProperty("db.host");
    String port = testProperties.getProperty("db.port");
    String user = testProperties.getProperty("db.user");
    String password = testProperties.getProperty("db.password");
    String driver = testProperties.getProperty("db.driver");
    String schema = testProperties.getProperty("db.schema");

    String url = "jdbc:mysql://" + host + ":" + port + "/" + schema;

    BasicDataSource ds = new BasicDataSource();
    ds.setDriverClassName(driver);
    ds.setUsername(user);
    ds.setPassword(password);
    ds.setUrl(url);
    TreeMap<String, String> map = new TreeMap<String, String>();
    map.put("mmxTag", "SELECT * FROM mmxTag ");
    doWork(ds.getConnection(), map);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    Properties properties = new Properties();
    try {/*  ww  w  .  j a v a2  s.  co m*/
        properties.load(new FileInputStream("filename.properties"));
    } catch (IOException e) {
    }
    String string = properties.getProperty("a.b");
    properties.setProperty("a.b", "new value");
}

From source file:Main.java

public static void main(String args[]) throws Exception {
    Properties prop = new Properties();
    FileInputStream fis = new FileInputStream("sampleprops.xml");
    prop.loadFromXML(fis);//  w  w  w .  j  a v  a2 s . com
    prop.list(System.out);
    System.out.println("\nThe foo property: " + prop.getProperty("foo"));
}