How to get query plan information from Postgres into JDBC

Sure, just run it as a regular statement:

Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("explain analyze select * from foo");
while (rs.next())
{
   System.out.println(rs.getString(1));
}

In addition to the answer supplied above, I would suggest that you make use of the ability to format EXPLAIN plans as XML in PostgreSQL 9.0 and later.

EXPLAIN ( analyze on, format xml ) SELECT ...

This will give you explain output you can more easily work with in Java by manipulating it as XML.