Reputation: 3341
In Eclipse, I just imported an external JAR
. Viewing any of the classes in the Package Explorer will instead of showing a source code open a Class File Editor with saying "Source not found". The folder of the JAR I have downloaded, however, has only JAR
, no lib
, no src
, no docs
.
Is there still a way how to view/generate a view the source code so then I can view it in Eclipse properly?
Upvotes: 1
Views: 3946
Reputation: 156
If possible I suggest you to use Maven for manage dependencies of your project, in most cases it did the trick for you. See: Get source JARs from Maven repository
Upvotes: 0
Reputation: 728
You cannot view the source form a .jar files as it contains binaries.Use a java decompiler instead to decompile the .class files and view their sources.
Upvotes: 2
Reputation: 10100
Try this :
Upvotes: 2
Reputation: 1437
.jar files don't contain source code but are more like binary files for Java.
You can either get the source code from the projects page (if it is an OpenSource project of course)
An other possible way to view the source code of a .jar file is by using a decompiler (http://jd.benow.ca/; Also has a Eclipse plugin I think). This method can be very painful though when an obfuscator has been used by the developer who generated the .jar file.
Upvotes: 3