How to recompile a .jar file?

Discussion in 'Java' started by Adam Jiang, Jan 29, 2007.

  1. Adam Jiang

    Adam Jiang Guest

    This is the situation.
    I got a two .jar files, one of which contained the classes and another
    one contained the source code related with certain class. When I put
    them in an eclipse project, and add source code for the class-jar file
    with source-jar file, I can view the code without modifying.
    Is this source read-only?
    How can I modify these code and then recompile this .jar file?
    Adam Jiang, Jan 29, 2007
    #1
    1. Advertising

  2. On Jan 29, 8:04 pm, "Adam Jiang" <> wrote:
    > This is the situation.
    > I got a two .jar files, one of which contained the classes and another
    > one contained the source code related with certain class. When I put
    > them in an eclipse project, and add source code for the class-jar file
    > with source-jar file, I can view the code without modifying.
    > Is this source read-only?
    > How can I modify these code and then recompile this .jar file?


    I imagine the IDE will *not* be able to edit the
    source files while they are in an *archive*.

    If you expand the archive out to 'loose files' on
    the local file system, and check they do not
    have the 'read only' attribute set (it is uncommon),
    the IDE should be able to edit them.

    You will probably need to reconfigure the project
    to work with the new arrangement, but that is a
    matter between you and your IDE.

    Andrew T.
    Andrew Thompson, Jan 29, 2007
    #2
    1. Advertising

  3. Adam Jiang

    ceasaro Guest

    On Jan 29, 10:12 am, "Andrew Thompson" <> wrote:
    > On Jan 29, 8:04 pm, "Adam Jiang" <> wrote:
    >
    > > This is the situation.
    > > I got a two .jar files, one of which contained the classes and another
    > > one contained the source code related with certain class. When I put
    > > them in an eclipse project, and add source code for the class-jar file
    > > with source-jar file, I can view the code without modifying.
    > > Is this source read-only?
    > > How can I modify these code and then recompile this .jar file?I imagine the IDE will *not* be able to edit the

    > source files while they are in an *archive*.
    >
    > If you expand the archive out to 'loose files' on
    > the local file system, and check they do not
    > have the 'read only' attribute set (it is uncommon),
    > the IDE should be able to edit them.

    To expand them you can use any program which understand the zip format
    cause a jar file is simply a zip archive.
    >
    > You will probably need to reconfigure the project
    > to work with the new arrangement, but that is a
    > matter between you and your IDE.
    >
    > Andrew T.
    ceasaro, Jan 29, 2007
    #3
  4. On Jan 30, 7:59 am, "ceasaro" <> wrote:
    ....
    > To expand them you can use any program which understand the zip format
    > cause a jar file is simply a zip archive.


    But note that it is dangerous to *make* jar's using
    'any old' zip tool. A lot of them have non-standard
    compression, and the way they write the zip
    archives is much less stringent than the format
    used by the jar tool, and Java.

    Andrew T.
    Andrew Thompson, Jan 30, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. lucy
    Replies:
    6
    Views:
    30,551
    steve
    Sep 7, 2004
  2. Arnold Peters
    Replies:
    0
    Views:
    551
    Arnold Peters
    Jan 5, 2005
  3. muttley
    Replies:
    0
    Views:
    2,687
    muttley
    Oct 20, 2005
  4. cyberco
    Replies:
    4
    Views:
    3,720
    Roedy Green
    Feb 14, 2006
  5. Arnold Peters
    Replies:
    0
    Views:
    637
    Arnold Peters
    Jan 5, 2005
Loading...

Share This Page