From 098acfcf2de1764446085c1900ada30616d9acf2 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Thu, 25 Nov 2010 19:36:36 -0500 Subject: [PATCH] playing with property loader stuff --- foobar.properties | 2 ++ src/ShowProps.java | 30 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 foobar.properties create mode 100644 src/ShowProps.java diff --git a/foobar.properties b/foobar.properties new file mode 100644 index 0000000..665a380 --- /dev/null +++ b/foobar.properties @@ -0,0 +1,2 @@ +foo.bar = hambones +ham.bones = foobar diff --git a/src/ShowProps.java b/src/ShowProps.java new file mode 100644 index 0000000..a75ddb4 --- /dev/null +++ b/src/ShowProps.java @@ -0,0 +1,30 @@ +import java.io.FileInputStream; +import java.util.Properties; + + +public class ShowProps { + public static String USAGE = "Usage: ShowProps "; + + 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(); + } + + } + +}