How to remove content from .jar files

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gaya3
    New Member
    • Aug 2007
    • 184

    How to remove content from .jar files

    Hi,
    can anyone please say me how to remove files from .jar file?
    For Example:
    I have created a sample .jar file with

    jar cf sample.jar A.class B.class etc

    Now i want to remove all except A.class from sample.jar.

    How could i do that?Thanks in Advance.

    -Thanks & Regards,
    Hamsa
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by gaya3
    Hi,
    can anyone please say me how to remove files from .jar file?
    For Example:
    I have created a sample .jar file with

    jar cf sample.jar A.class B.class etc

    Now i want to remove all except A.class from sample.jar.

    How could i do that?Thanks in Advance.

    -Thanks & Regards,
    Hamsa
    You have to extract and jar again.

    Comment

    • sukatoa
      Contributor
      • Nov 2007
      • 539

      #3
      Originally posted by gaya3
      Hi,
      can anyone please say me how to remove files from .jar file?
      For Example:
      I have created a sample .jar file with

      jar cf sample.jar A.class B.class etc

      Now i want to remove all except A.class from sample.jar.

      How could i do that?Thanks in Advance.

      -Thanks & Regards,
      Hamsa
      Use WinRAR.... Open that jar file as WinRAR...
      Edit the content...

      And save it as .jar again....

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        Originally posted by gaya3
        Hi,
        can anyone please say me how to remove files from .jar file?
        For Example:
        I have created a sample .jar file with

        jar cf sample.jar A.class B.class etc

        Now i want to remove all except A.class from sample.jar.

        How could i do that?Thanks in Advance.

        -Thanks & Regards,
        Hamsa
        There is no command to delete file(s) from a .jar archive but there is hope: the .jar
        file format is identical to the .zip file format. There are many .zip file handlers.

        kind regards,

        Jos

        ps. this was a tip ;-)

        edit: darn, too slow again ;-)

        Comment

        • gaya3
          New Member
          • Aug 2007
          • 184

          #5
          Originally posted by JosAH
          There is no command to delete file(s) from a .jar archive but there is hope: the .jar
          file format is identical to the .zip file format. There are many .zip file handlers.

          kind regards,

          Jos

          ps. this was a tip ;-)

          edit: darn, too slow again ;-)

          Thanks for all response..Thank u once again

          -Thanks & Regards,
          Hamsa

          Comment

          • nausadh
            New Member
            • May 2012
            • 1

            #6
            hello all jus use the followin command to delete files from jar

            zip -d jarfilename classfilename.c lass

            Thank

            Comment

            Working...