Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Usage of JAR commad

 
kishore skipper
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic