playing with property loader stuff
This commit is contained in:
parent
7c2260ac73
commit
098acfcf2d
2
foobar.properties
Normal file
2
foobar.properties
Normal file
@ -0,0 +1,2 @@
|
||||
foo.bar = hambones
|
||||
ham.bones = foobar
|
30
src/ShowProps.java
Normal file
30
src/ShowProps.java
Normal file
@ -0,0 +1,30 @@
|
||||
import java.io.FileInputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
|
||||
public class ShowProps {
|
||||
public static String USAGE = "Usage: ShowProps <properties-file>";
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
try {
|
||||
|
||||
if (args.length >= 1) {
|
||||
FileInputStream instream = new FileInputStream(args[0]);
|
||||
Properties props = new Properties();
|
||||
props.load(instream);
|
||||
instream.close();
|
||||
props.list(System.out);
|
||||
|
||||
} else {
|
||||
System.out.println(USAGE);
|
||||
return;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("OMG FAIL");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user