How to View Jre's Source Code in Eclipse

How do I view JRE's source code in Eclipse?

You need to have the JDK installed. Then you can look in JDK_INSTALL_DIR\src.zip

For me it is C:\Program Files\java\jdk1.6.0_11\ (depends on your current version)

You don't need to get a special open source version.

How do I view JRE's source code in Eclipse on linux (debian)

The JRE is purely the runtime environment needed to run Java programs. For the development of Java programs, you need the JDK (Java Development Kit).

The JDK itself is split up into several packages, including the JRE, documentation, demos, and the source files.

Assuming that you're using Open JDK 6, sudo apt install openjdk-6-source would install and link the source code that you're looking for.

How to see the source code for java SDK (java.lang, java.util, ...) classes in Eclipse?

In order to see the source codes of JDK in eclipse you should add JDK path instead of JRE to your workspace or for a specific project SDK. I assume you are a developer and you've installed JDK on your system.

To do that:

  1. Right click and select Properties (or press Alt+Enter) on your project.
  2. From the left tree styled menu select Java Build Path
  3. On the right select the Libraries
  4. Select the JRE System Library

Sample Image


  1. From the right side buttons click on edit, and edit the path from JRE location to points to the JDK location in your file system.

Sample Image

Sample Image

Sample Image


  1. Then click on Finish and the OK buttons of all opened dialogs to save the configurations and you set to go.

Hope this would be helpful.

How to display the source code of an external JAR in Eclipse?

Try this :

  • Download java decompiler from http://jd.benow.ca/ and now double
    click on jd-gui and click on open file.
  • Then open .jar file from that folder.
  • Now you get class files and save all these class files (click on file
    then click "save all sources" in jd-gui) by src name.

Attach the Java Source Code

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

how to import Java-7 source code in eclipse

I Have to give JDK 7 path. I had given JRE-7 which is available with Eclipse. in class path and was checking.

How to make Eclipse detect the right Java source code

In the Eclipse Java IDE the default JRE is set to the JRE that is used to run Eclipse. In Windows, when installing a JDK, a JRE is also installed (e. g. after installing a 64 bit JDK you will have both C:\Program Files\Java\jdk<version>\bin\java.exe and C:\Program Files\Java\jre<version>\bin\java.exe). Unfortunately, the JRE is used by Windows by default and therefore by Eclipse by default.

In your case, maybe the easiest way is to add an embedded Java JDK to your Eclipse ZIP to share (this also avoids the need to install Java):

  1. Create a folder jre
  2. Copy everything from a Java JDK installation directory (e. g. installed Windows 64 bit Java JDK: from C:\Program Files\Java\jdk-9) into the jre folder
  3. Add the jre folder to your Eclipse ZIP to share


Related Topics



Leave a reply



Submit