Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2014-01-09
1
Medium Priority
?
1,259 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
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

916 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