pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adam Rauch <adam@labkey.com>
To: 'Thomas Kellerer' <spam_eater@gmx.net>
To: pgsql-jdbc@postgresql.org
Subject: Re: postgresql-9.2-1002.jdbc4.jar does not work with Java6
Date: Thu, 15 Nov 2012 09:09:36 -0800
Message-ID: <06e001cdc353$fe219cd0$fa64d670$@labkey.com> (raw)
In-Reply-To: <k82di2$h80$1@ger.gmane.org>
References: <k80udc$b81$1@ger.gmane.org>
	<CADK3HHKh6v4u0n4oDtPXPxb2G+nu4m+7pjcfJKJr1wngDsc2Hg@mail.gmail.com>
	<CADK3HHLR=BLk21YjZUOZ7Qfa8PSxjWR2xum-VXjxa-koS_x8kg@mail.gmail.com>
	<0fa46b92-e6cd-446c-8101-2f995e621377@googlegroups.com>
	<k82di2$h80$1@ger.gmane.org>

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@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 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@postgresql.org) To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc





view thread (9+ messages)

Message-ID: <06e001cdc353$fe219cd0$fa64d670$@labkey.com>
Permalink:  ../06e001cdc353$fe219cd0$fa64d670$@labkey.com/
Also on:    postgresql.org/message-id/06e001cdc353$fe219cd0$fa64d670$@labkey.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: adam@labkey.com, spam_eater@gmx.net
  Subject: Re: postgresql-9.2-1002.jdbc4.jar does not work with Java6
  In-Reply-To: <06e001cdc353$fe219cd0$fa64d670$@labkey.com>
  References: <k80udc$b81$1@ger.gmane.org> <CADK3HHKh6v4u0n4oDtPXPxb2G+nu4m+7pjcfJKJr1wngDsc2Hg@mail.gmail.com> <CADK3HHLR=BLk21YjZUOZ7Qfa8PSxjWR2xum-VXjxa-koS_x8kg@mail.gmail.com> <0fa46b92-e6cd-446c-8101-2f995e621377@googlegroups.com> <k82di2$h80$1@ger.gmane.org> <06e001cdc353$fe219cd0$fa64d670$@labkey.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox