Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Java and Linux, Can not unzip and zip a jar file

Posted on 2014-01-09
1
Medium Priority
?
1,179 Views
Last Modified: 2014-01-10
I am using RHEL 6.5 and java 1.7

I test my jar file and it works successfully

I copy the jar file to a test directory and unzip it as follows:

cp test.jar /home/jar
mkdir /home/zipfile
cd /home/zipfile
unzip ../jar/test.jar

Open in new window


This unzips everything correctly

I then zip up the file as follows

cd /home/zipfile
zip -r /home/test.jar *.*
cd /home
cp test.jar /testdir
cd testdir

Open in new window


Now when I test the jar file I get the following error:

Error: Invalid or corrupt jarfile test.jar

Open in new window


What did I do wrong.  Was there a special flag I needed.  Any ideas ?

Thanks
0
Comment
Question by:Los Angeles1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 14

Accepted Solution

by:
CPColin earned 2000 total points
ID: 39769829
Try using * in your zip command, instead of *.*, which skips the META-INF directory. Java needs that directory in order to figure out what to do with the JAR file.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Fine Tune your automatic Updates for Ubuntu / Debian
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question