Merge remote-tracking (subtree) branch 'PracticingJava/master'

This commit is contained in:
Dan Buch 2012-03-03 20:17:08 -05:00
commit 8506e9286e
7 changed files with 86 additions and 0 deletions

2
PracticingJava/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.class
dist

27
PracticingJava/build.xml Normal file
View File

@ -0,0 +1,27 @@
<?xml version="1.0"?>
<project name="LearningJava" default="build">
<target name="clean" description="remove intermediate files">
<delete>
<fileset dir="obj" includes="**/*.class"/>
</delete>
</target>
<target name="build" description="compile Java sources">
<javac srcdir="src" destdir="obj" includeantruntime="yes"/>
</target>
<target name="jar" depends="build"
description="create Jar from compiled sources">
<mkdir dir="dist" />
<jar destfile="dist/learning-java.jar">
<fileset dir="obj" includes="**/*.class"/>
</jar>
</target>
<target name="hello" depends="build" description="runs HelloSir">
<java classname="com.meatballhat.learningjava.HelloSir"
classpath="obj"/>
</target>
</project>

View File

@ -0,0 +1,2 @@
foo.bar = hambones
ham.bones = foobar

0
PracticingJava/obj/.keep Normal file
View File

View File

@ -0,0 +1,14 @@
package com.meatballhat.learningjava;
import java.io.IOException;
public final class CleanPipe {
public static void main(String[] argv) throws IOException {
int c;
while((c = System.in.read()) != -1) {
System.out.write(c);
}
}
}

View File

@ -0,0 +1,9 @@
package com.meatballhat.learningjava;
public class HelloSir {
public static void main(String[] argv) {
System.out.println("OMG Hi Der");
}
}

View File

@ -0,0 +1,32 @@
package com.meatballhat.learningjava;
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();
}
}
}