MaDa
MaDa

Reputation: 10762

How to compile JDBC 3.0-compatible sources with JDK 1.6?

I need to compile an old library written for JDBC 3.0 with 1.6 JDK (which contains JDBC 4.0). It's not possible, because newer JDBC interfaces contain Blob and Clob-related methods, and so classes implementing them can't compile. Implementing new methods in the library is not an option.

Can this be done with JDK 1.6, or do I need to install 1.5 JDK?

Upvotes: 3

Views: 351

Answers (1)

Mark Rotteveel
Mark Rotteveel

Reputation: 109004

You don't need to install JDK1.5, but you will need the Java 5 rt.jar and specify it on the bootclasspath of the compiler:

javac -source 1.5 -target 1.5 -bootclasspath /path/to/jre5/lib/rt.jar

Otherwise you will be compiling with the Java6 rt.jar which contains the JDBC 4 interfaces, and then the compiler will complain about unimplemented methods. Using an already compiled JDBC 3.0 library will work OK under Java 6 up to the point that a method added in JDBC 4 is called.

Upvotes: 3

Related Questions