Compiling/running 3.0 RC1 for/under Java 1.5

104 views
Skip to first unread message

Tom Cleghorn

unread,
Oct 25, 2012, 5:37:06 AM10/25/12
to epub...@googlegroups.com
Morning,

I'm trying to use epubcheck as a library called from a simple class within an Ant build for automatic QA on generated EPUBs; I'm informed that we can't easily update the version of Java on the production environment that the build has to run on, so we need to be able to run under 1.5.

When calling my class from Ant, the build fails with "java.lang.UnsupportedClassVersionError: Bad version number in .class file". I get the same when running the distributed jar on its own ("java -jar epubcheck-3.0-RC-1.jar test.epub") under 1.5, but not under 1.6. This led me to try compiling epubcheck under JDK 1.5, but this fails with:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project epubcheck: Compilation failure
[ERROR] \local\devel\epubcheck-src-3.0-RC-1\src\main\java\com\adobe\epubcheck\css\CSSChecker3.java:[39,-1] cannot access com.phloc.css.ECSSVersion
[ERROR] bad class file: c:\local\devel\m2repo\com\phloc\phloc-css\3.2.1\phloc-css-3.2.1.jar(com/phloc/css/ECSSVersion.class)
[ERROR] class file has wrong version 50.0, should be 49.0

Under JDK 1.6, the Maven build seems to compile successfully, but it results in dozens of failed tests and no jar (log attached). I've also tried changing java.version at l.119 of pom.xml to 1.5, but get the same results. As a matter of curiosity, I also tried under openjdk1.6 on an Ubuntu system, but still got the same outcome.

Am I missing something obvious? Or should I give up on 1.5 and set about making a case for updating Java on the target system? Any pointers or advice will be most gratefully received - I'm happy to provide more logs if necessary (I've tried to keep this concise!)

Many thanks
Tom Cleghorn
Content Systems Controller
Cambridge University Press

jdk16compile.log

Romain Deltour

unread,
Oct 25, 2012, 6:52:22 AM10/25/12
to epub...@googlegroups.com
EpubCheck notably depends on phloc-css which is compiled for Java 6, so I don't think you can target Java 5 out of the box.

That said, by looking at the parent POM for phloc-css, it seems they provide a way to build against 1.5:

You could try to build your own version of the phloc libraries, then try again compiling EpubCheck for 1.5.

If it doesn't work, I suppose you need to update your JVM to 1.6…

HTH
Romain.

--
You received this message because you are subscribed to the Google Groups "epubcheck" group.
To post to this group, send email to epub...@googlegroups.com.
To unsubscribe from this group, send email to epubcheck+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/epubcheck?hl=en.
<jdk16compile.log>

Tom Cleghorn

unread,
Oct 25, 2012, 8:56:26 AM10/25/12
to epub...@googlegroups.com
Thanks for the suggestion, but no dice, unfortunately. I've now successfully compiled both phloc-css and phloc-commons for 1.5 and put them in my local maven repo - both build flawlessly, but building epubcheck with 1.6 still fails. I also tried building with 1.5, but got this: "[ERROR] \local\devel\epubcheck-src-3.0-RC-1\src\main\java\com\adobe\epubcheck\css\CSSChecker3.java:[83,33] method does not override a method from its superclass"
...and 28 more of the same referring to other locations. I commented out the @Override lines (just to see if it'd compile), and got more failed tests for my troubles.

Should we conclude that epubcheck no longer works under Java 1.5?

Tom
Reply all
Reply to author
Forward
0 new messages