I took an old jar file and edited it. Now i have a folder that has all the files and I want to recompile them back to a jar file. How do i do this?
Open a command prompt window and go to the directory where you saved the java program. Assume it's C:\. Type 'javac MyFirstJavaProgram. java' and press enter to compile your code.
On your first question JD-GUI is just a viewer you need to use dex2jar to retrieve the JAR file; decompile and save the classes you need to change; import JAR and JAVA files in your Android Studio; modify; recompile and repackaged.
Jar files aren't "compiled" in the normal sense of the word. But you just create one with the jar
command:
jar cvf myfile.jar file1 file2 etc
You can use globbing as normal:
jar cvf ../myfile.jar *
Run jar -?
or read the docs for more information.
Note that for an executable jar file, you'll need to specify the manifest file as well.
How did you edit it?
Anyway, jar
files follow the same format as regular zip
files. If you want to update the content of the jar ( probably with a new file ) you could do:
jar -uf yourJar.jar path/to/updated/Class.class
That would update your jar with the file path/to/updated/Class.class
If there's already a class with that name in that path, it would be replaced. If is not it would be created.
After this your jar is up to date.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With