{"id":1833,"date":"2022-08-30T15:19:49","date_gmt":"2022-08-30T15:19:49","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/12\/02\/struggling-to-update-jre-dependencies-within-maven-and-eclipse-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:19:49","modified_gmt":"2022-08-30T15:19:49","slug":"struggling-to-update-jre-dependencies-within-maven-and-eclipse-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/struggling-to-update-jre-dependencies-within-maven-and-eclipse-collection-of-common-programming-errors\/","title":{"rendered":"Struggling to update JRE dependencies within Maven and Eclipse-Collection of common programming errors"},"content":{"rendered":"<p>I&#8217;m trying to build a large Open Source project in Eclipse; it uses Maven so I&#8217;ve installed the various plugins (m2eclipse etc) but I&#8217;m a little unfamiliar with this setup.<\/p>\n<p>I can build and run the particular JAR I&#8217;m interested in with no issues. However, when the newly built JAR tries to open a large ZIP file, I get this:<\/p>\n<pre><code>Exception in thread \"main\" java.lang.RuntimeException: java.util.zip.ZipException: invalid CEN header (bad sig\nnature)\n        at org.opentripplanner.graph_builder.impl.GtfsGraphBuilderImpl.buildGraph(GtfsGraphBuilderImpl.java:17\n9)\n        at org.opentripplanner.graph_builder.GraphBuilderTask.run(GraphBuilderTask.java:127)\n        at org.opentripplanner.graph_builder.GraphBuilderMain.main(GraphBuilderMain.java:51)\nCaused by: java.util.zip.ZipException: invalid CEN header (bad signature)\n        at java.util.zip.ZipFile.open(Native Method)\n        at java.util.zip.ZipFile.(Unknown Source)\n<\/code><\/pre>\n<p>I did some research and it seems that this error means that java.util.ZipFile can&#8217;t read the file because it&#8217;s in ZIP64 format. Apparently this was fixed in Java 1.7, so dutifully I&#8217;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:<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/ql9XS.png\" \/><\/p>\n<p>However, this doesn&#8217;t work &#8211; I still get the error even having re-built the whole project.<\/p>\n<p>Is it possible that the old java.util.zip is still being pulled in from somewhere? I&#8217;m not too familiar with how linking works in Java, can older JDKs be &#8217;embedded&#8217; like this within dependencies? Or does the java.util.zip just get used that&#8217;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&#8217;s pulled in as a Maven dependency:<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/PnovG.png\" \/><\/p>\n<p>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 &#8216;parent project&#8217; that&#8217;s regressing my new JRE 1.7 back to 1.6? Sorry if these questions are naive.<\/p>\n<p>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?<\/p>\n<ol>\n<li>\n<p>Assuming that the problem is really caused by using an older version of Java, then rebuilding is not going to make any difference. The <strong>real problem<\/strong> is that your application JAR is <em>running<\/em> on an older JRE.<\/p>\n<p>In the command shell you are using to run your application, run <code>java -version<\/code>. That will tell you what JDK \/ JRE will be used when you then run <code>java -jar yourApp.jar ...<\/code><\/p>\n<\/li>\n<li>\n<p>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 <strong>NOT<\/strong> the IDE anymore. So changing the compiler version must be done in the pom.xml file and <strong>NOT<\/strong> in the IDE.<\/p>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-12-02 20:56:47. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I&#8217;m trying to build a large Open Source project in Eclipse; it uses Maven so I&#8217;ve installed the various plugins (m2eclipse etc) but I&#8217;m a little unfamiliar with this setup. I can build and run the particular JAR I&#8217;m interested in with no issues. However, when the newly built JAR tries to open a large [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1833","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1833","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1833"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1833\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1833"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1833"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1833"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}