adding class files to an existing archive
1 posts in topic
Flat View  Flat View

Posted By:   Jayashree_Gopal
Posted On:   Monday, December 17, 2001 03:07 AM

i have downloaded the .class files of servlet2.3 . I have successfully archived the .class files which is under javax.servlet.* package.However, i am unable to understand how do i add the .class files which are under javax.servlet.http. package to the same archive.

Where do i place the already created .jar file. Please give me the exact syntax.

I placed my .jar file under http folder and ran the command jar cvfu Servlet.jar *.class but it did not work.


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.

About | Sitemap | Contact