Home java java. Use jar.

java. Use jar.

Author

Date

Category

You must use the function that is in some Jar. There are no source code. But at the same time, I do not want to increase your program for a couple of MB for the sake of one function. Can I solve such a problem?


Answer 1, Authority 100%

If you really need this code, it remains only one way out: decompile .jar file, and then just scope the desired code to yourself.
In any case, you can simply open JAR through JD-GUI (~ 0.5MB, without installation) , not even spending time on decompilingation.


Answer 2, Authority 67%

You can decompile!


Get the methods you need for your actions and implement them yourself in your program

Use the decompiler you can not only take some specific file from .jar, but also any of its package.

Small list of procinations:

Java Decompiler

Apparently, the most popular Java decompiler. It itself provides a console interface, has not been supported for a long time and is not updated, but still many graphic tools that work with this decompiler still make it used if it is necessary to decompile small Java classes.

Mocha

is one of the first Java decompiors issued. Like JavaDeCompiler, MoCham submits a console interface, the last release took place in 1996.

dj java decompiler

For a long time, used only as the Java Decompiler graphic shell for a faster and convenient selection of command-line arguments to call JAD. However, in the current version, there is support for annotations.

FernFlower

Probably one of the best Java application decompilants at the moment. The latest version includes support for parametric types, annotations, assertions, listed types, also really competently decompubulate byte code obtained due to known compiler bugs.

Java Decompiler Project

jd-core

Highly functional library for decompiling byte-code Java, the development of which was carried out within the framework of Java Decompiler Project. It is written in full on C++ (extraordinarily fast), does not require a special installation, correctly performs its direct task, the truth is subject to this decompiler as part of the JD-GUI application, which does not allow its development in third parties.

This project includes:

I personally, very much like the built-in decompiler in the Idellij Idea IDE, he
Very qualitatively disassembled code.
He is so cool that you can go into the source of Java itself and see how and what works. Well, a very cool product …

The only thing I want to say: “Remember the copyright!”. Before decomporping, make sure you do not break the law.
(For yourself in a quiet one)


Answer 3, Authority 33%

AFAIK JAR is a zip archive .Class files. You can try to pull out only you need .class file and connect to your project.


Answer 4

Only in one way – to write the same function, unless of course it is feasible.


Answer 5

I propose to use the analytical decompiler Fern Flower
In the Sovie Time this decompiler helped me a lot to get the code of one commercial Billig. The quality of the decompilator’s work is acceptable, I managed to pull a lot with the Ipplicity of this product.


Answer 6

And what if you open this jar and watch it .class files via IDEA – this is certainly not the source, but if you want to want strongly, You can copy the desired method.


Answer 7

Here is another service for online decompiling Jar and Class files to the original Java Code: Decompile Android APK Quick and convenient and do not need to configure anything.


Answer 8

Can you easier to connect only 1 function to the source?

import lala.blahblah.some_func;

If not to use decompiling, then this is the best way. Only 1 function will be added to your program code, but the dependences of

will occur

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions