Invalid Jar Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business invalid or corrupt jarfile java Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation
Error Invalid Or Corrupt Jarfile Linux
Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like
Invalid Or Corrupt Jarfile Minecraft
you, helping each other. Join them; it only takes a minute: Sign up Corrupt jar file up vote 14 down vote favorite 4 I have created a jar file in windows 7 using eclipse. When I am
Invalid Or Corrupt Jar File Eclipse
trying to open the jar file it says invalid or corrupt jar file. Can anyone suggest me why the jar file is invalid? Thanks in advance. java windows eclipse jar share|improve this question edited Sep 26 '11 at 17:57 BalusC 684k20924802695 asked Sep 26 '11 at 17:49 Neel 2,36272648 2 can you elaborate what you actually did to get the jar. Plus, did you try unzipping the jar and see the contents? –Nishant Sep 26 intellij invalid or corrupt jarfile '11 at 17:51 add a comment| 6 Answers 6 active oldest votes up vote 23 down vote accepted This will happen when you doubleclick a JAR file in Windows explorer, but the JAR is by itself actually not an executable JAR. A real executable JAR should have at least a class with a main() method and have it referenced in MANIFEST.MF. In Eclispe, you need to export the project as Runnable JAR file instead of as JAR file to get a real executable JAR. Or, if your JAR is solely a container of a bunch of closely related classes (a library), then you shouldn't doubleclick it, but open it using some ZIP tool. Windows explorer namely by default associates JAR files with java.exe, which won't work for those kind of libary JARs. share|improve this answer edited Dec 2 '14 at 12:37 thSoft 10.7k45776 answered Sep 26 '11 at 17:56 BalusC 684k20924802695 This time I tried it with Runnable JAR file but when I did java -jar solution.jar it shows error instead of corrupt jar. But when I am running the program from eclipse there is no run time error. –Neel Sep 26 '11 at 18:09 1 What error did you got then? The error message contains the answer to your problem. Try not to ignore error messages as if they
this here. Share on http://stackoverflow.com/questions/7559072/corrupt-jar-file kikKik Share on twitterTwitter Share on facebookFacebook Can't find what you're looking for? Contact Us Related articles Changes to our Symbian and https://kikinteractive.zendesk.com/hc/en-us/articles/217681058-What-does-the-Download-failed-Invalid-JAR-907-error-mean-BlackBerry- BlackBerry apps Why can't I open or save pictures and videos I receive? My message is stuck on S. How do I get it to send? Why can't I register an account? (BlackBerry) Why don't pics and videos I send or receive appear in my chat? About Blog Press Terms Privacy Law Enforcement © Kik Interactive Inc, 2016. All Rights Reserved. Powered by Zendesk
my main class: $ java -jar foo.jar Error: Invalid or corrupt jarfile foo.jar Running it via the class path worked fine: $ http://dan.bodar.com/2014/02/17/error-invalid-or-corrupt-jarfile/ java -cp foo.jar Bar Hello world! So now I knew it was something to do with the manifest file but it wasn't being caused by The 65535 file limit (See Zip64 and Java 7 ). The 72 bytes limit per line Missing newline at the end of the Main-Class (Displays "no main manifest attribute, in foo.jar" A blank line before Main-Class (Displays "Error: An invalid or unexpected error occurred while trying to open file foo.jar" So after scratching my head for a while I tried comparing a working jar with the failing jar: $ unzip -lv foo.jar Archive: foo.jar Length Method Size Cmpr Date Time CRC-32 Name -------- ------ ------- ---- ---------- ----- -------- ---- 75 Defl:N 75 0% 2014-02-17 16:01 b1eac370 META-INF/MANIFEST.MF 825 Defl:N 464 44% 2014-02-17 16:01 942f187c Working.class invalid or corrupt $ unzip -lv foo.jar Archive: foo.jar Length Method Size Cmpr Date Time CRC-32 Name -------- ------ ------- ---- ---------- ----- -------- ---- 75 Defl:N 75 0% 2014-02-17 16:01 b1eac370 /META-INF/MANIFEST.MF 825 Defl:N 464 44% 2014-02-17 16:01 942f187c Failing.class So don't prefix the META-INF folder with a slash! Also note it is case sensitive! Post navigation Previous PostShortcuts to position screens on ultra wide screensNext PostHow to list Active Directory controllers from Linux command line 3 thoughts on “Error: Invalid or corrupt jarfile” Eric says: April 14, 2014 at 4:15 pm Actually leading slash is forbidden by .ZIP File Format Specification (http://www.pkware.com/documents/casestudies/APPNOTE.TXT). It's 4.4.17 clause indicate: The path stored MUST not contain a drive or device letter, or a leading slash. All slashes MUST be forward slashes ‘/' (…). It's weird if Java API creates such invalid jars. Raymond Barlow says: February 19, 2015 at 4:08 pm Thanks Dan! We had the 65535 jar limit problem and your blog pointed me in the right directions. Ultimately fixed by doing this: java -jar app.jar # becomes java -cp app.jar app.Main (thanks to https://github.com/sbt/sbt/issues/850) anonymous says: March 19, 2015 at 7:31 pm Thank you!