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
compileagainst 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@postgresql.org [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Thomas Kellerer
Sent: Thursday, November 15, 2012 1:45 AM
To: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] postgresql-9.2-1002.jdbc4.jar does not work with Java6
boscher.marc@gmail.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
compilebut 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@postgresql.org) To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc