Solved

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

Posted on 2014-01-09
1
942 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 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now