View sources of used Java classes in IntelliJ Idea

前端 未结 5 2047
借酒劲吻你
借酒劲吻你 2021-02-05 15:08

In visual studio development environment when you use a library if you have the related pdb you can dig into their sources during debug. I wonder is there any way to have this f

5条回答
  •  情话喂你
    2021-02-05 15:40

    Of course, quoting the documentation:

    Libraries may optionally include the source code for the library classes as well as corresponding API documentation. [...] However, it adds the ability to use inline documentation extracted from the source code, and also to view the API documentation right from the IDE.

    The documentation doesn't mention you can then debug external libraries, which is obviously also possible.

    In order to add sources choose:

    • File | Project Structure
    • Click Libraries tab
    • Pick library and click + icon
    • Find a JAR file containing sources.

    If you are using build tool like maven, IntelliJ will automatically download and attach available source to all libraries, no manual work needed.

提交回复
热议问题