Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ Compilation Error zip END header not found

The Issue

I am unable to compile Java code for an imported Eclipse project on IntelliJ build 182.4505.22 on Java 9 and 10. The following error is displayed when compiling the module, or any individual file:

Error:(1, 1) java: cannot access edu.wit.cs.comp2000

zip END header not found

Details

The structure of the project is as follows: IntelliJ project structure

The full compile-time output is as follows: enter image description here

Already Attempted

I have reviewed posts here and here, which do not provide any relevant details. I have attempted compiling on both Java 9 and 10, which makes no difference. I have written a main method into LinkedBag and attempted to run that independent of JUnit, which results in the same error. IntelliJ is not correctly displaying the testing icons in my test class, so I suspect that JUnit (or lack of JUnit) is the cause of the issue, however I am unsure how to proceed. Compiling works for other projects (without JUnit tests) just fine.

Updates

  • The code seems to compile and test as expected on Java 1.8 without issue. Switching to Java 9 or 10 causes the above issue every time. I am beginning to suspect that one of my instructor's dependencies requires Java 1.8 specifically, however I would still like to use newer versions of Java if anyone might have a solution.
like image 311
J. Blackadar Avatar asked Sep 19 '18 17:09

J. Blackadar


4 Answers

As mentioned above, just delete the corrupted cache and restart Intellij.

Running gradle in the commandline can help knowing what you should delete. For instance:

$ ./gradlew --version
Could not unzip /home/cesarc/.gradle/wrapper/dists/gradle-5.6.2-all/9st6wgf78h16so49nn74lgtbb/gradle-5.6.2-all.zip to /home/cesarc/.gradle/wrapper/dists/gradle-5.6.2-all/9st6wgf78h16so49nn74lgtbb.
Reason: error in opening zip file

and after deleting the folder /home/cesarc/.gradle/wrapper/dists/gradle-5.6.2-all/9st6wgf78h16so49nn74lgtbb the problem was solved:

$ ./gradlew --version
Downloading https://services.gradle.org/distributions/gradle-5.6.2-all.zip
......
like image 181
Fulvio Flaco Avatar answered Oct 09 '22 23:10

Fulvio Flaco


We had this issue when internet connection dropped while Idea was downloading project dependencies. We solved it by deleting the corrupted file from cache. Cache location depends on your build tool, e. g. for Maven it's in ~/.mvn, for Gradle it's in ~/.gradle.

like image 29
dizeee Avatar answered Oct 09 '22 22:10

dizeee


I Had Similar issue in my mac.I just deleted .m2 repository and did maven clean install again worked.

like image 6
Rocky4Ever Avatar answered Oct 09 '22 23:10

Rocky4Ever


In my case, it was: /.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.41/tomcat-embed-core-9.0.41.jar I just removed it and I was able to compile my code. Just pay attention to the .jar file in your case it's giving an error. Just remove it and you are good to go.

like image 4
Abhishek Patre Avatar answered Oct 09 '22 23:10

Abhishek Patre