Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDBC driver built with JDK 11 cannot be used with JDK 8 #143

Open
staticlibs opened this issue Feb 20, 2025 · 0 comments · May be fixed by #144
Open

JDBC driver built with JDK 11 cannot be used with JDK 8 #143

staticlibs opened this issue Feb 20, 2025 · 0 comments · May be fixed by #144

Comments

@staticlibs
Copy link

When building the Java part, -source and -target options are set to 1.8, but -bootclasspath option is not set, so it gives the following warning during compilation:

warning: [options] bootstrap class path not set in conjunction with -source 8

And fails the following way when run on Java 8:

Exception in thread "main" java.lang.NoSuchMethodError: java.nio.ByteBuffer.position(I)Ljava/nio/ByteBuffer;
    at org.duckdb.DuckDBResultSet$DuckDBBlobResult.<init>(DuckDBResultSet.java:435)
    at org.duckdb.TestDuckDBJDBC.blobOf(TestDuckDBJDBC.java:3954)
    at org.duckdb.TestDuckDBJDBC.<clinit>(TestDuckDBJDBC.java:4045)
staticlibs added a commit to staticlibs/duckdb-java that referenced this issue Feb 20, 2025
When compiling Java part with JDK 11 (or later), the current javac
options `-source 1.8` and `-tatget 1.8` are ineffective. Resulting
bytecode format is compatible with JDK 8, but cannot be run on JDk 8
because it is compiled against the bootstrap classpath of JDK 11 and
depends on methods not available in JDK 8.

This change removes these cross-compilation flags. It is assumed, that
official release binaries are always built with JDK 8. For
users/packagers, who is going to build the driver from source, a
CMake configure-time warning about JDK 8 compatibility is added.

Additionally Java debuginfo is added to the JAR (`-g` flag). It does
not affect the performance and the JAR size increase is minor (less
than 10KB).

Fixes: duckdb#143
@staticlibs staticlibs linked a pull request Feb 20, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant