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

dasrohith
  • 533
  • 2
  • 8
  • 21
Pawan
  • 1,614
  • 3
  • 18
  • 32
  • 1
    And which answers have you found? – Tom Oct 10 '14 at 08:32
  • Compile it with `javac` and use `jar` to make a jar from the compiled class. – Jens Oct 10 '14 at 08:38
  • 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. – Pawan Oct 10 '14 at 08:48

1 Answers1

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

dasrohith
  • 533
  • 2
  • 8
  • 21
  • how do i find out the dependencies ?? – Pawan Oct 10 '14 at 08:48
  • Easy approach - Try to import the extracted source code. The compilation errors will leads you to find out the dependencies – dasrohith Oct 10 '14 at 08:51
  • 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. – Pawan Oct 10 '14 at 08:59
  • 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. – dasrohith Oct 10 '14 at 09:04
  • 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 there – Massimo Petrus Aug 21 '20 at 06:46