Decompile class, amend and re-add to ear

1k Views Asked by At

I have an Ear file. I took a Java class file out, decompiled it and edited it.

I now want to recompile the new Java source file and re-add the resulting class file to my new Ear.

When I tried to recompile the new Java source file, the compiler complained about unrecognised classes, imports etc. I expected this.

My question is, can I recompile this new class and add it to my new Ear?

3

There are 3 best solutions below

2
On

Perhaps the classes needed are also in the EAR. If not, you need to create stubs for all the classes, it needs.

0
On

Yes, you'll need to add all the dependencies to the classpath

0
On

I abandoned the idea of decompile, recompile and readd. I rebuilt the entire Ear from scratch.