-
Notifications
You must be signed in to change notification settings - Fork 3
/
jar.patch
69 lines (64 loc) · 1.38 KB
/
jar.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
diff --git a/build.xml b/build.xml
index 9cbde3a..72d63dc 100644
--- a/build.xml
+++ b/build.xml
@@ -165,6 +165,45 @@
</target>
+ <target
+ name="jar"
+ depends="compile"
+ description="Creates a standalone JAR of all class files and dependencies."
+ >
+
+ <jar
+ destfile="whitespace4j.jar"
+ update="true"
+ >
+
+ <manifest>
+
+ <attribute
+ name="Main-Class"
+ value="uk.ac.glasgow.whitespace4j.Main"
+ />
+
+ </manifest>
+
+ <fileset
+ dir="bin"
+ />
+
+ <fileset
+ dir="."
+ includes="log4j.properties"
+ />
+
+ <zipfileset
+ src="lib/log4j-1.2.17.jar"
+ excludes="META-INF/**/*"
+ />
+
+ </jar>
+
+ </target>
+
+
<target
name="build"
depends="compile"
diff --git a/src/uk/ac/glasgow/whitespace4j/Main.java b/src/uk/ac/glasgow/whitespace4j/Main.java
index f07fff3..3d7410c 100644
--- a/src/uk/ac/glasgow/whitespace4j/Main.java
+++ b/src/uk/ac/glasgow/whitespace4j/Main.java
@@ -32,8 +32,13 @@ public class Main {
*/
public static void main (String[] args){
- PropertyConfigurator.configure("log4j.properties");
+ PropertyConfigurator.configure(Main.class.getResourceAsStream("/log4j.properties"));
+ if (args.length != 2) {
+ System.err.println("Usage: whitespace4k (DEFAULT | VISIBLE) <file>");
+ System.exit(2);
+ }
+
CharacterSet characterSet = CharacterSet.valueOf(args[0]);
String filePath = args[1];