Re: postgresql-9.2-1002.jdbc4.jar does not work with Java6

From: "Adam Rauch" <adam(at)labkey(dot)com>
To: "'Thomas Kellerer'" <spam_eater(at)gmx(dot)net>, <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: postgresql-9.2-1002.jdbc4.jar does not work with Java6
Date: 2012-11-15 17:09:36
Message-ID: 06e001cdc353$fe219cd0$fa64d670$@labkey.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

You can avoid this problem by specifying a "bootclasspath," an alternate runtime library for javac to cross-compile against. I always compile with JDK 7, for convenience and to take advantage of the latest fixes and compile-time optimizations, but when targeting 1.5, I specify a Java 5 copy of rt.jar on the bootclasspath and when targeting 1.6, I compile against the Java 6 rt.jar. This eliminates the possibility of errant references.

javac switch is -bootclasspath (http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javac.html)
javac ant task parameter is bootclasspathsrc (http://svn.apache.org/repos/asf/ant/core/trunk/manual/Tasks/javac.html)

Adam

-----Original Message-----
From: pgsql-jdbc-owner(at)postgresql(dot)org [mailto:pgsql-jdbc-owner(at)postgresql(dot)org] On Behalf Of Thomas Kellerer
Sent: Thursday, November 15, 2012 1:45 AM
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: [JDBC] postgresql-9.2-1002.jdbc4.jar does not work with Java6

boscher(dot)marc(at)gmail(dot)com, 14.11.2012 22:30:
>
> Isn't it just a question of specifying the target java version in
> javac

That is not completely reliable.

If you accidently include references to classes or methods in your code that are only available in Java7 it will still compile but fail to run with Java6.

So if you want to be 100% it runs with Java6 you have to compile it with a Java6 JDK

Thomas

--
Sent via pgsql-jdbc mailing list (pgsql-jdbc(at)postgresql(dot)org) To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message David Johnston 2012-11-15 22:19:51 Re: The column name <col> was not found in this ResultSet
Previous Message Dave Cramer 2012-11-15 13:57:18 Re: Missing changelogs