Ben McCann

Co-founder at Connectifier.
ex-Googler. CMU alum.

Ben McCann on LinkedIn Ben McCann on AngelList Ben McCann on Twitter


Embedded Jetty


One of the coolest things about Jetty is the ability to run it in embedded mode.  This means that you can write a Java app with a main method that will launch a Jetty server.  This has some really nice benefits.  For example, it makes it really easy to deploy a server to EC2 because Read More

Easy Java Bean toString() using BeanUtils


I often want to have a String description of my beans for debugging or logging purposes, but hate having to manually concatenate the fields in my class to create a toString() method. This code snippet using Apache Commons is very helpful for just such occasions. Thanks to Paul Wilton who suggested this updated code snippet in Read More

HTML Parsing using the Firefox DLLs


One of my first posts was a comparison of HTML parsers. Today I found a particularly challenging document to parse. None of the parsers I had compared earlier were able to handle the malformed HTML in this table where the td elements were prematurely ended. The behavior of Neko and HtmlCleaner made the most sense Read More

Suppressing Compile Warnings with Java Annotations


If you’ve used Java 1.5 Generics much then you’re probably familiar with the following compile warning: “Type safety: The expression of type List needs unchecked conversion to conform to List<String>” or similar. It turns out there’s a rather simple solution with annotations to ignore this problem: @SuppressWarnings(“unchecked”) A couple other possible uses of the annotation Read More

Running Ant within Eclipse


I tried to run an Ant target within Eclipse today and got a fun error: BUILD FAILED java.lang.NoClassDefFoundError: com/sun/javadoc/Type This happened because Ant could not find tools.jar, which contains classes to used to run javac and javadoc. The solution: Open up Window->Preferences->Java->Installed JREs Set your default JRE to a JDK/SDK Open up the one you Read More