The problem doesn't appear to be specific to the JDBC driver. Tried a quick version of this in Python for grins with a database that was already populated by the Java code (sadly, the psycopg2 library doesn't directly support prepared statements):
import psycopg2
import time
conn = psycopg2.connect('dbname=test')
cur = conn.cursor()
cur.execute('PREPARE myplan AS '
'SELECT col2 FROM test WHERE col1 = $1 AND col2 LIKE $2 ORDER BY col2')