How to recompile a .jar file?

A

Adam Jiang

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?
 
A

Andrew Thompson

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.
 
C

ceasaro

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.
 
A

Andrew Thompson

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top