Recompile the java files which is decompiled by JD-GUI from a jar
Asked Answered
C

1

6

I have a MyFile.jar file. I use JD-GUI to decompile it and used its "Save All Sources" options to save the files to a .zip file. Now extracted the .zip file and edited a .java file.

the folder structure after extracting .zip file is like this

                       _____ META-INF(folder)
source(folder) -------|     
                      ------com(folder)-->example--->App---> all .java files   

now how do i recompile it back to .jar file ??

Cistaceous answered 10/10, 2014 at 8:31 Comment(3)
And which answers have you found?Celtic
Compile it with javac and use jar to make a jar from the compiled class.Reverso
i tried to compile the .java filed using javac but i get errors in various .java files -- error: package android.os does not exist, error: cannot file symbol .etc . how do i resolve these errors.Cistaceous
E
0

As mentioned in your question, you have decompiled the class files to java files and have done necessary modifications.

Hope you have imported that as a project in eclipse. Export the same as jar. point to be noted is that you should know the dependencies for building the project

Engraft answered 10/10, 2014 at 8:39 Comment(5)
how do i find out the dependencies ??Cistaceous
Easy approach - Try to import the extracted source code. The compilation errors will leads you to find out the dependenciesEngraft
i tried to import project into eclipse(juno-downloaded from the android developers website) by browsing to the source folder but eclipse shows no projects found to import.Cistaceous
As it is a jar, you cannot import the project. Better to create a project(I prefer maven) and copy the source. Sorry for using the word 'import'. That made the confusion.Engraft
often sources decompiled with JD have several errors in it. You should in any case fix your classes, in eclipse for exampe, As said by dasrohith, create a project in eclipse and put your classes thereMarni

© 2022 - 2024 — McMap. All rights reserved.