craigwblake / redline

Pure Java Rpm Library
http://redline-rpm.org
MIT License
128 stars 97 forks source link

NoSuchMethodError when run on Java 6 #28

Closed amjjd closed 10 years ago

amjjd commented 11 years ago

Scanner throws this when run on JDK6:

Exception in thread "main" java.lang.NoSuchMethodError: java.nio.CharBuffer.subSequence(II)Ljava/nio/CharBuffer;
    at org.freecompany.redline.payload.CpioHeader.readChars(CpioHeader.java:158)
    at org.freecompany.redline.payload.CpioHeader.readSix(CpioHeader.java:148)
    at org.freecompany.redline.payload.CpioHeader.read(CpioHeader.java:188)
    at org.freecompany.redline.Scanner.main(Scanner.java:59)

This is caused by this addition in JDK7: http://bugs.sun.com/view_bug.do?bug_id=6733145

Building with JDK6 or JDK5 fixes it, but I have to verify that a version built using JDK6 will work when run using Java 7 - on a Snow Leopard Mac at the moment so I can't check.

craigwblake commented 11 years ago

Thanks, will look into this.

craigwblake commented 10 years ago

The upcoming release will be built with Java 6 to correct this.

ngutzmann commented 10 years ago

I am under the impression that version 1.1.14 was still built using JDK7 as this bug is still occurring:

java.lang.NoSuchMethodError: java.nio.CharBuffer.subSequence(II)Ljava/nio/CharBuffer;
        at org.freecompany.redline.payload.CpioHeader.readChars(CpioHeader.java:162)
        at org.freecompany.redline.payload.CpioHeader.readSix(CpioHeader.java:152)
        at org.freecompany.redline.payload.CpioHeader.read(CpioHeader.java:192)
        at org.freecompany.redline.payload.CpioHeader$read.call(Unknown Source)

Edit: When I do a file command on each class file in the jar I recieve the output:

<ClassName>.class: compiled Java class data, version 49.0 (Java 1.5)

This leads me to believe that the class files may have been generated for a Java5 bytecode format, however using Java7 libraries.

merscwog commented 10 years ago

When is the expected release of 1.1.15?

If it is not imminent, would it also be possible to re-release the older versions, at least 1.1.14 (and ideally back to 1.1.12) as redline-1.1.14-java6.jar as built by a Java 6 JDK?

Fortunately, everything seems to work fine under Java 7 when compiled with a Java 6 JDK.

It's easy to build with java 6, but it's the publication to Maven Central that would need to be officially done.

-Spencer