简体   繁体   中英

Java Edit Jar File

I have a jar file which includes seviral classes. In that jar there is a Confirmation.class file which i want to edit. I decompiled that class by usin JAD. Then i edit it with notepad++ and saved as .java file.

Now how can i create my new jar file with other classes?

Other files format is .class but mine is .java, is it problem?

If it is , how can i compile my .java class ? (when i use command javac Confirmation.java it gives errors and want other classes)

Thanks..

Do you have dependencies to other jars?

If this is the case, you will have to put them on the compiler classpath in advance.

In any case, just decompile all the package (I use jd-gui), change the class, compile, open the original jar as a zip, put the new class on it, and you are done.

Another approach is to create dummy classes for the missing dependencies...

Personally, I really discourage this approach of "reverse engineering" working with an already compiled package, but I understand situations where you don't have access to the original source code, but you need to fix something urgently (ex: working in a company, where your code comes from an external provider on the other side of the planet...)

You may try to copy & paste the code in Java IDE such as Eclipse , NetBeans , etc and ask the IRC to compile for u. Have a nice day :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM