Where can I see the Sun JDK source code?

I want to see how Java implements LinkedList. Where should I look for source code?

+63
java linked-list
Nov 04 '08 at 5:52
source share
11 answers

Install the Java SE development kit from http://java.sun.com/javase/downloads/index.jsp .

After installation, you should find the archive named src.zip at the top of the JDK installation directory. The Java source code is there.

File java/util/LinkedList.java .

update: you can also visit the OpenJDK Source online repository . See this answer below.

+61
Nov 04 '08 at 6:01
source share

You have a source in docjar :

LinkedList.java (from openjdk-7 )

+19
Nov 04 '08 at 6:32
source share

Sources are hosted on hg.openjdk.java.net . Library sources for a specific version of the JDK can be found in the src/share/classes section. For example, the JDK 8 source for java.util.LinkedList is located at:

hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/tip/src/share/classes/java/util/LinkedList.java

You can follow the instructions here to study the source.

+10
Mar 15 2018-11-11T00:
source share

As already mentioned, you have the src.zip file installed with Sun JDK if you selected it during installation. Moreover, if you use eclipse and add JDK to your JRE list, it will automatically add sources to the jar, and if you try to open a class using Ctrl + Shift + T (Open Type), you are a LinkedList type and it will show you the class code .

+3
Nov 04 '08 at 8:44
source share

If you have a JDK, you can find the source in the src.zip file.

If you have an IDE, you can just ctrl + click or a similar class / method that you want to see.

+3
Jun 01 '09 at 21:09
source share

grepcode.com has the source code for almost all open source projects. It also provides common IDE functions such as search, derived types, etc.

Here you can find the LinkedList source: http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8u40-b25/java/util/LinkedList.java/

+3
Jun 29 '16 at 8:53 on
source share
+2
Nov 04 '08 at 6:00
source share

I would say we start with the OpenJDK repository , but I don't see anything for LinkedList objects.

+1
Nov 04 '08 at 6:01
source share

zGrepCode has an online Java open source directory. Java Java classes are available here: https://zgrepcode.com/java/openjdk/10.0.2/java.base/sun/

And here is the LinkedList implementation code. Hope it helps.

+1
Jul 28 '18 at 6:51
source share

If you have IntelliJ IDEA, then click the LinkedList constructor (if you don't have a LinkedList constructor, create one), then press CTRL + B or, if you have a Mac, press CMD + B.

0
Sep 26 '17 at 4:36 on
source share

The best way to view Java source code is to install the Intelli-J community version. Create a new Java project, and inside your project create a new class. Inside the class, if you want to see the LinkedList source code, create a new LinkedList object as follows:

 public class LinkedListWatch{ public static void main(String[] args){ LinkedList linkedList = new LinkedList(); } } 

Now ctrl + mouse left click on the LinkedList class will lead you to the LinkedList source code. You can learn a lot, and it can be very helpful.

enter image description here enter image description here

You can also look at the implementation of the Stack class; very useful.

Enjoy your search for open source Java.

0
Jul 23 '18 at 6:00
source share



All Articles