Storyyeller / Krakatau

Java decompiler, assembler, and disassembler
GNU General Public License v3.0
1.95k stars 219 forks source link

v2 seems not to have an option to assemble multiple classes into a single .jar #196

Closed mr-kelsey closed 1 year ago

mr-kelsey commented 1 year ago

Disassembled great from a single jar into the multiple classes using the krak2 dis File.jar --out directory/.

However, trying to assemble those classes back into a single jar file does not seem supported. krak2 asm --out Modified.jar directory/ results in a Missing input file extension for 'directory/' error.

I just found the tool but it appears as though version 1 allowed an -r flag for assembling multiple classes from a given directory. Is this planning to be supported in the future?

Thanks for the great work so far!

Storyyeller commented 1 year ago

I wasn't planning to implement it, but if it is an important use case, then I'll consider it.

mr-kelsey commented 1 year ago

I mean... probably not a big enough deal to worry about if you don't have the desire to implement it.

A good workaround (or at least the one that worked for me) was to krak2 asm each .j file into it's own class. Then jar cf New.jar *.class and java -cp New.jar Entry.

I think it would be nice to have the ability to single line it from within your tool but I don't think it's strictly necessary.

Let me know your thoughts so that I can close the issue if it's not something you want to mess with.

Storyyeller commented 1 year ago

One thing I've been wondering about is if we need a way to automatically copy in non-class files like MANIFEST.MF. It seems like that is more important to making jar creation convenient.

mr-kelsey commented 1 year ago

Hmm... I suppose I don't really see the point of pulling out the manifest if the tool can't assemble a jar. I mean, if the user is going to have to use other tools to put the jar together, they can use other tools to pull the manifest as well, right? I would say either go for both and add the convenience on both sides or just leave it alone and stay focused on the (dis)assembly that the tool does so well.

Of course, my naivete may be showing here and there may be other use cases that I am not considering.

Storyyeller commented 1 year ago

Well one thing is that you can assemble multiple classfiles from a single .j file. You can currently disassemble an entire jar to a merged .j file, and then assemble that back to a jar, but it won't have a manifest.

mr-kelsey commented 1 year ago

Ah... I did not realize that the tool could assemble multiple classfiles from the single .j file. I have just finished testing this out and it works perfectly. I would expect that having the manifest available for reassembly would be quite a nice feature.

oleksandrborniak commented 1 year ago

I wasn't planning to implement it, but if it is an important use case, then I'll consider it.

In my opinion, this is important. I would be grateful if you would consider it. Thank you.