Quantcast

Ben McCann

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

AngelList Twitter LinkedIn Google+

Java

Installing Oracle Java JDK on Ubuntu

03/23/2012

Due to licensing restrictions, Ubuntu no longer comes with Oracle’s Java JDK. You can install it by running: sudo mkdir -p /opt/java/64 cd /opt/java/64 sudo wget http://download.oracle.com/otn-pub/java/jdk/6u31-b04/jdk-6u31-linux-x64.bin sudo chmod 755 ./jdk-6u31-linux-x64.bin sudo ./jdk-6u31-linux-x64.bin sudo rm ./jdk-6u31-linux-x64.bin sudo update-alternatives –install /usr/bin/java java /opt/java/64/jdk1.6.0_31/bin/java 2000 \ –slave /usr/bin/javac javac /opt/java/64/jdk1.6.0_31/bin/javac \ –slave /usr/bin/javadoc javadoc /opt/java/64/jdk1.6.0_31/bin/javadoc \ –slave Read More

Embedded Tomcat

08/28/2011

Earlier in the year, I posted a quick writeup on how to run an embedded Jetty instance. Today, I’m posting basically the same code showing how to run an embedded Tomcat instance. The embedded Tomcat API is much nicer since it matches closely the web.xml syntax. However, the embedded Tomcat instance takes much longer to Read More

Using the Guice Struts 2 plugin

03/29/2011

Guice 3.0 was released a few days ago!  One of the easiest ways to use it in your web server is to use Struts 2 with the Struts 2 plugin, which is available in the central Maven repository. This tutorial assumes familiarity with Guice and Struts 2. In order to use it the plugin, your Read More

Remote Java debugging in Eclipse

03/08/2011

To debug a Java program being run on the command line from Eclipse you can start the Java program in remote debugging mode: java -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y -jar myProgram.jar The program will wait for you to attach the Eclipse debugger to it. Open Eclipse and choose: Run > Debug Configurations… > Remote Java Application > New Read More

Google GXP Struts 2 Plugin

02/02/2011

Google GXP is a replacement for JSP that provides compile-time type safety.  This article is a quick introduction on how to use GXP with Struts 2.   1. Download the jar.  It’s not in Maven yet because it’s still unreleased.   2. Install the jar in Maven or otherwise put it on your classpath.  You’ll Read More

Commons Math vs. ojAlgo

01/23/2011

There are numerous math libraries for Java.   This is frustrating as a user because it’s hard to decide which to use.   Sometimes an algorithm is implemented in one library, but not another, which means you must marshal your data between proprietary formats.  I was working on solving systems of linear equations and there Read More

Embedded Jetty

01/19/2011

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

Using Struts 2 on Google App Engine

12/20/2009

Google App Engine (GAE) has some great benefits such as scalability and the fact that it’s free to start.  When using Struts 2 with Google App Engine there a few things to keep in mind. The first is that it runs inside a security sandbox that is more restrictive than your typical Java environment.  This Read More

Case Study: Usable and Unusable APIs

07/25/2009

It was the best of times, it was the worst of times… It was the age of wisdom, it was the season of light.  A great library called dom4j was written with its users in mind.  It included a quick start guide and a cookbook for people that actually wanted to get things done.  Converting Read More

Older Posts