0

Is there any way to view the source code of existing jars like those in Maven dependencies in Eclipse. enter image description here

How is it possible to browse on the libs and view the source codes?

Manish Basdeo
  • 6,139
  • 22
  • 68
  • 102

1 Answers1

0

You can use Java decompiler plugin (Jad).
It will decompile class file and you can see source code. This plugin can be easily integrated with eclipse

You can use below link to configure Jad in eclipse
http://www.mkyong.com/java/java-decompiler-plugin-for-eclipse/

Manoj
  • 59
  • 2
  • This does not allow you to browse the actual source. – Stephen C May 21 '16 at 06:16
  • It will decompile the class file and you can see source code. – Manoj May 21 '16 at 06:20
  • @Manoj Note that StephenC writes: "This does not allow you to browse the *actual* source." Compiling and decompiling code will rarely yield the original code, if ever. Some code won't decompile at all. And the decompiled source will not contain the original comments. – Arjan May 21 '16 at 06:52
  • Like I said. Not the >>actual<< source code. What it is displaying is a (possibly inaccurate) reconstruction of the source code without any of the comments, original local variable names, etcetera. The reconstructed code may not be valid Java code. And if the bytecodes were obfuscated, the chances are that it will be unreadable. – Stephen C May 21 '16 at 06:53
  • Using a decompiler should only be consider if there is no legal / practical way to get the real source code. (And after checking that you are not violating a license agreement by decompiling.) – Stephen C May 21 '16 at 06:58
  • I agree with StephenC and Arjan that decompilation code is not exactly same as actual source. As it will have complier optimization also. My point was if you don't have source code as an ideal situation then this method can be used to get an idea what this code is doing. – Manoj May 21 '16 at 07:01