Struggling to update JRE dependencies within Maven and Eclipse-Collection of common programming errors

I’m trying to build a large Open Source project in Eclipse; it uses Maven so I’ve installed the various plugins (m2eclipse etc) but I’m a little unfamiliar with this setup.

I can build and run the particular JAR I’m interested in with no issues. However, when the newly built JAR tries to open a large ZIP file, I get this:

Exception in thread "main" java.lang.RuntimeException: java.util.zip.ZipException: invalid CEN header (bad sig
nature)
        at org.opentripplanner.graph_builder.impl.GtfsGraphBuilderImpl.buildGraph(GtfsGraphBuilderImpl.java:17
9)
        at org.opentripplanner.graph_builder.GraphBuilderTask.run(GraphBuilderTask.java:127)
        at org.opentripplanner.graph_builder.GraphBuilderMain.main(GraphBuilderMain.java:51)
Caused by: java.util.zip.ZipException: invalid CEN header (bad signature)
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.(Unknown Source)

I did some research and it seems that this error means that java.util.ZipFile can’t read the file because it’s in ZIP64 format. Apparently this was fixed in Java 1.7, so dutifully I’ve updated the JDK on OS X, and tried to change the Maven project by right-clicking on it in Eclipse, then altering the Project Facet, which in turns seems to have updated the JRE libraries in that project to 1.7:

However, this doesn’t work – I still get the error even having re-built the whole project.

Is it possible that the old java.util.zip is still being pulled in from somewhere? I’m not too familiar with how linking works in Java, can older JDKs be ’embedded’ like this within dependencies? Or does the java.util.zip just get used that’s on the target machine? (this is definitely JRE 1.7) I know for a fact that the code throwing the exception is actually contained within a separate JAR that’s pulled in as a Maven dependency:

Do I need to track down and re-build this external JAR against Java 1.7, is that the issue here? Or is there a concept of a Maven ‘parent project’ that’s regressing my new JRE 1.7 back to 1.6? Sorry if these questions are naive.

I originally thought that it would be as simple as just updated the JRE on the runtime machine, but apparently not. So how do I resolve this error?

  1. Assuming that the problem is really caused by using an older version of Java, then rebuilding is not going to make any difference. The real problem is that your application JAR is running on an older JRE.

    In the command shell you are using to run your application, run java -version. That will tell you what JDK / JRE will be used when you then run java -jar yourApp.jar ...

  2. The most important point in relationship with maven is bear in mind that the source of the truth is the pom file in Maven and NOT the IDE anymore. So changing the compiler version must be done in the pom.xml file and NOT in the IDE.