Attach the Java Source Code

前端 未结 14 1607
傲寒
傲寒 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:05

    Old question, be here's what I ended up using Java Source Attatcher plugin: http://marketplace.eclipse.org/content/java-source-attacher#.U85j4rF-N7s

    It can provide source for different opensource projects. One weird thing thou, if you have libraries under libs folder, you cannot attach from there, but you need to attach source clicking on jar displayed under "Libraries from external".

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

    You need to attach java sources which comes with JDK(C:\Program Files\Java\jdk1.8.0_71\src.zip).

    Steps(**Source: link):

    1. Select any Java project
    2. Expand Referenced libraries
    3. Select any JAR file, in our case rt.jar which is Java runtime
    4. Right click and go to properties
    5. Attach source code by browsing source path.
    0 讨论(0)
  • 2020-11-29 00:07

    Normally, if you have installed the JDK6u14, eclipse should detect it and declare it automatically in its "installed JRE" list.

    If not, you can add that JDK through "Windows/Preferences": Java > Installed JREs:

    Just point to the root directory of your JDK installation: it should include the sources of the JDK (src.zip), automatically detected and attached to rt.jar by eclipse.

    Add JRE VM, from pic.dhe.ibm.com/infocenter/iadthelp/v8r0/topic/org.eclipse.jdt.doc.user/tasks/images/task-add_jre_std_vm.PNG

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

    Hold ctrl key and then click on class of which you want to see the inner working (for ex: String) then you will find there button "Attach Source". Click on it. Then click on External Folder. Then browse to your jdk location, per instance C:\Program Files\Java\jdk1.6.0. That's it.

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

    The easiest way to do this, is to install a JDK and tell Eclipse to use it as the default JRE. Use the default install.

    (from memory)

    Open Window -> Prefences. Select Installed Java runtimes, and choose Add. Navigate to root of your JDK (\Programs...\Java) and click Ok. Then select it to be the default JRE (checkmark).

    After a workspace rebuild, you should have source attached to all JRE classes.

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

    Answer For Eclipse 2019 With ScreenShots

    • Step 1: Window -> Preferences -> Java -> Installed JREs

    • Step 2: Select Currently used JRE, now Edit option will get enabled, Click on edit option

    • Step 3: Select rt.jar from JRE systems library, click on corresponding drop down to expand

    • Step 4: Select Source attachment none, Click on Source Attachment Button, Source attachment configuration window will appear, Select external location

    • Step 5: Select src.zip file from jdk folder, say ok ok finish

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