It's not a secret anymore!
The moose likes Java in General and the fly likes Usage of JAR commad Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Usage of JAR commad" Watch "Usage of JAR commad" New topic

Usage of JAR commad

kishore skipper

Joined: Aug 19, 2009
Posts: 26

I want to update a file inside a JAR file but when i use the command "JAR uf xyz.jar asd.class" it is adding classes. I dont want to add classes if they aren't exists inside JAR. How to achieve this.

Can somebody help me out with JAR command usage?


john price
Ranch Hand

Joined: Feb 24, 2011
Posts: 495

I personally like to just create the whole JAR file all over again. It is very simple, and I don't have to worry about all the different possible codes for jars...I just use the standard "jar cmf nameofjar.jar *.class *.otherfiles". Here are some links to help you with JAR files (and specifically what you are asking for). If you create the jar again, it will delete your old one, so you don't have to worry about updating or what not.

Using JAR Files : The Basics -

Updating a JAR file -

Distributing your Application as an executable JAR file -

For Using JAR stuff (such as sound files)...
The sound files would be located in your JAR...
Java Game Programming : Playing Sound

These are links which I found hours finding...Add them to your bookmarks and they you will be doing yourself a favor.


“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” (Mosher's Law of Software Engineering)
“If debugging is the process of removing bugs, then programming must be the process of putting them in.” (Edsger Dijkstra)
I agree. Here's the link:
subject: Usage of JAR commad
It's not a secret anymore!