Solved

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

Posted on 2014-01-09
1
1,118 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 500 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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses

624 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