harwey / cups4j

Cups4j Java printing library for CUPS/IPP
http://cups4j.org
GNU Lesser General Public License v3.0
130 stars 64 forks source link

On the Unification of JDK versions #40

Closed lixunyi closed 3 years ago

lixunyi commented 3 years ago

Thank you very much for providing such a good class library, which is currently in version 0.7.6. I found that I could not get the status of the printer, so I came to check the source code and was surprised to find that a new version was recently released (0.7.7). Unfortunately, it is found that this version is compiled based on jdk11, given that the server has been stable in jdk1.8. So I would like to ask if it is possible to release a version of jdk1.8.

m2ger commented 3 years ago

Got the same problem:

java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer;

    at org.cups4j.operations.IppOperation.getIppHeader(IppOperation.java:115)
    at org.cups4j.operations.IppOperation.request(IppOperation.java:64)
    at org.cups4j.operations.cups.CupsGetPrintersOperation.getPrinters(CupsGetPrintersOperation.java:59)
    at org.cups4j.CupsClient.getPrinters(CupsClient.java:138)
$ java -version
openjdk version "1.8.0_265"
OpenJDK Runtime Environment (build 1.8.0_265-8u265-b01-0ubuntu2~18.04-b01)
OpenJDK 64-Bit Server VM (build 25.265-b01, mixed mode)

I wonder did this commit cause it: https://github.com/harwey/cups4j/commit/485721706d29c574c7f8f20925cd3913e772f30e#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8R49

    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>

Some more info: https://stackoverflow.com/questions/61267495/exception-in-thread-main-java-lang-nosuchmethoderror-java-nio-bytebuffer-flip

Edit: to be clear, no issues with 0.7.6

C4J commented 3 years ago

Probably down to the latest Eclipse IDE - that comes with JDK 11 as default. You can still work with 1.8 though.

Sent from my iPhone

On 17 Oct 2020, at 12:34, Indrek Toom notifications@github.com wrote:

 Got the same problem:

java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer;

at org.cups4j.operations.IppOperation.getIppHeader(IppOperation.java:115) at org.cups4j.operations.IppOperation.request(IppOperation.java:64) at org.cups4j.operations.cups.CupsGetPrintersOperation.getPrinters(CupsGetPrintersOperation.java:59) at org.cups4j.CupsClient.getPrinters(CupsClient.java:138) $ java -version openjdk version "1.8.0_265" OpenJDK Runtime Environment (build 1.8.0_265-8u265-b01-0ubuntu2~18.04-b01) OpenJDK 64-Bit Server VM (build 25.265-b01, mixed mode) I wonder did this commit cause it: 4857217#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8R49

<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>

Some more info: https://stackoverflow.com/questions/61267495/exception-in-thread-main-java-lang-nosuchmethoderror-java-nio-bytebuffer-flip

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

harwey commented 3 years ago

Okay, done, will push to Maven Central today.

m2ger commented 3 years ago

will push to Maven Central today.

Can confirm that the problem above is gone with version 0.7.8. Thanks a lot!