Re: adding class files to an existing archive
Posted By:
Simon_Ablett
Posted On:
Thursday, December 20, 2001 06:08 AM
To add a new class file to an existing jar.
1. Add the class to the jar file using the 'jar' command with the 'uvf' commands (u=update, v=verbose and f=archive file name).
to create a new jar file from scratch use 'jar' with the 'cvf' options
2. Check that it's been added successfully using 'jar tvf' plus the archive's name.
3. Add the jar file (if it's not already listed there) to your classpat.
3. Add the requisite import statement to your source file.
Hope that this helps.
Why did you use 'jar cvfu' ? I have never seen anyone use 'c' and 'u' together. 'c' creates a new empty jar file. 'u' updates an existing one. So if you use 'c' an existing jar would be overwritten but with only the specified new files as its contents. Also, why are you adding to javax archives instead of creating your own? If you do this and then update the version of the JDK you're using you'll have to go through the process again.
Regards.