Well, I ran into a strange situation. My code for Part 1 gets the following Exception and stack trace on the Linux boxen:
java My211Zip c h test.txt test.hc Exception in thread "main" java.lang.StackOverflowError at java.lang.Integer.compareTo(Integer.java, Compiled Code) at java.lang.Integer.compareTo(Integer.java, Compiled Code) at java.util.TreeMap.compare(TreeMap.java, Compiled Code) at java.util.TreeMap.getEntry(TreeMap.java, Compiled Code) at java.util.TreeMap.get(TreeMap.java, Compiled Code) at HuffmanTreeGenerator.writeChar(HuffmanTreeGenerator.java, Compiled Code) at Huffman.compress(Huffman.java, Compiled Code) at My211Zip.main(My211Zip.java, Compiled Code)
I also tried it with a -mx128m, no difference. The code works perfectly on both my machine and the Sun boxen, even without the extra memory, which suggests that maybe a newer version of the Java VM may be necessary on the Linux box. Because I like to work on Linux, this only took me a frustrating hour to figure out. So heads up to Linux users... |