Attach the Java Source Code

前端 未结 14 1606
傲寒
傲寒 2020-11-28 23:37

I cannot for the life of me attach the java source code to eclipse so I can see the inner workings of the language. Not even something as simple as the String Class.

相关标签:
14条回答
  • 2020-11-29 00:15

    You don't necessarily need to add the source, but you rather may need to remove a JRE that does not have the source attached.

    On looking at the "installed JRE's" I saw that my JDK was setup properly with source, but the default JRE on the machine had no sources. Eclipse was defaulting to that when looking for source.

    I just used the remove button to expel the JRE, leaving my JDK. I then hit F3 and the source was there. Yeah!

    0 讨论(0)
  • 2020-11-29 00:21

    Easy way that just worked for me:

    1. Check if you have a jdk installed (it is usually in "Program Files\Java", if you don't have one, install it.
    2. Link it to eclipse. In Preferences --> Java --> Installed JREs remove the JRE installed and add the JDK.

    Then the project will detect it and add the new libraries from the JDK. At the end of this process it looks like the screenshot I attach.

    0 讨论(0)
提交回复
热议问题