File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

Usage of JAR commad

kishore skipper
Greenhorn

Joined: Aug 19, 2009
Posts: 26
Hi,



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?

Thanks

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 nameofmf.mf 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.
Links:

Using JAR Files : The Basics -
http://java.sun.com/developer/Books/javaprogramming/JAR/basics/

Updating a JAR file -
http://java.sun.com/developer/Books/javaprogramming/JAR/basics/update.html

Distributing your Application as an executable JAR file -
http://introcs.cs.princeton.edu/java/85application/jar/jar.html

For Using JAR stuff (such as sound files)...
The sound files would be located in your JAR...
Java Game Programming : Playing Sound
http://www.ntu.edu.sg/home/ehchua/programming/java/J8c_PlayingSound.html

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

Cheers,
cc11rocks


“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: http://aspose.com/file-tools
 
subject: Usage of JAR commad
 
Similar Threads
Creating an executable jar (solved)
Under Java Security Manager, accessing a file inside a jar
Can a non-executable (ie class library) JAR file contain other JAR files?
comparing 2 jar files with timsramp and size
Help with classpath inside JAR