How can I see the source code of jar files

When I add a jar file into the classpath of a module ,how can I see the source code of classes the jar include.You know,in eclipse we can click the class in the jar first then select the source code file of the jar so that when we click the class again we can see its real source code,not discompiled.Does idea offer a simliar function?

4 comments
Comment actions Permalink

Hello fxbird,

When I add a jar file into the classpath of a module ,how can I see
the source code of classes the jar include.You know,in eclipse we can
click the class in the jar first then select the source code file of
the jar so that when we click the class again we can see its real
source code,not discompiled.Does idea offer a simliar function?


Yes. You can go to Settings | Project Settings, find the library in question
and use the "Attach Sources" button to attach the sources to it.

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

thank you

0
Comment actions Permalink

Hi, I have attached the compiled class files in myJavaLib1.jar, myJavaLib2.jar etc  in the Project Settings | Modules | Dependencies.

It is not possible to right click on those jar's and "Attach source".  The right menu only displays "Navigate" and nothing else.

So.. after 30 minutes of trying to find out how to attach Source Jars to a project, no luck. The "help" is not helpful in this regard.

Can anyone please point the way here?

My version is 7.0.5.

thanks,

stephen boesch

0
Comment actions Permalink

Settings | Project Settings | Libraries | Choose some | on the right side click Attach Sources.

But you are right, doing this by right click on project view is a nice feature.
You can fill a JIRA request.

http://www.jetbrains.net/jira/browse/IDEA

0

Please sign in to leave a comment.