Skip to content

Instantly share code, notes, and snippets.

@ejknapp
Created October 7, 2010 20:09
Show Gist options
  • Select an option

  • Save ejknapp/615801 to your computer and use it in GitHub Desktop.

Select an option

Save ejknapp/615801 to your computer and use it in GitHub Desktop.
package java112.labs2;
import java.io.*;
import java.util.*;
/**
* @author Eric Knapp
* class PropertiesDemo
*
*/
public class PropertiesDemo {
private Properties properties;
public void run() {
loadProps();
System.out.println("author: " + properties.getProperty("author"));
System.out.println("email: " + properties.getProperty("email"));
}
public void loadProps() {
properties = new Properties();
try {
properties.load(this.getClass().getResourceAsStream("/analyzer.properties"));
} catch (IOException ioe) {
System.out.println("Can't load the properties file");
ioe.printStackTrace();
} catch (Exception e) {
System.out.println("Problem: " + e);
e.printStackTrace();
}
}
public static void main(String[] args) {
PropertiesDemo demo = new PropertiesDemo();
demo.run();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment