我在哪里可以看到Sun JDK的源代码?

时间:2022-03-26 07:10:24

I want to have a look at how Java implements LinkedList. Where should I go to look at the source code?

我想看看Java是如何实现LinkedList的。我应该去哪里看源代码?

8 个解决方案

#1


59  

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

从http://java.sun.com/javase/downloads/index.jsp安装Java SE开发工具包。

Once installed, you should find an archive called src.zip in the top of the JDK installation directory. The Java source code is in there.

一旦安装,您应该找到一个名为src的归档文件。压缩到JDK安装目录的顶部。Java源代码在其中。

The file is java/util/LinkedList.java.

文件的java / util / LinkedList.java。

update: You may also like to visit the online OpenJDK Source repository. See this answer below.

更新:您也可以访问在线的OpenJDK源存储库。请参阅下面的答案。

#2


18  

You have the source in the docjar:

你在docjar中有来源:

LinkedList.java (from the openjdk-7)

LinkedList。java(openjdk 7)

#3


10  

The sources are hosted at hg.openjdk.java.net. You can find the library sources for a specific JDK version under src/share/classes. For example, the JDK 8 source for java.util.LinkedList is located at:

源代码托管在hg.openjdk.java.net上。您可以在src/share/类下找到特定JDK版本的库源。例如,java.util的JDK 8源代码。LinkedList位于:

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

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

You can follow the instructions here to explore the source.

您可以按照这里的说明来探索源代码。

#4


3  

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

如前所述,您有一个src。如果在安装过程中选择了Sun JDK,则使用它安装zip文件。此外,如果您使用eclipse并将JDK添加到JRE列表中,它将自动将源代码附加到jar中,如果您尝试使用Ctrl+Shift+T (open Type)打开类,您将输入LinkedList,它将显示类的代码。

#5


3  

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

如果您有一个JDK,您可以在src中找到源代码。zip文件。

If you have an IDE, you can just ctrl+click or similar on the class/method you want to see the definition of.

如果你有一个IDE,你可以在你想要看到的类/方法上按ctrl+click或者类似的方法。

#6


3  

grepcode.com has source code of almost all opensource projects. It also provides common IDE features like find usages, derived types, etc.

grepcode.com拥有几乎所有开源项目的源代码。它还提供了常见的IDE特性,如查找用法、派生类型等。

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

在这里,您可以找到LinkedList源代码:http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8u40-b25/java/util/LinkedList.java/

#7


2  

Here:

在这里:

http://hg.openjdk.java.net/

http://hg.openjdk.java.net/

#8


1  

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

我想说从OpenJDK存储库开始,但是我没有看到LinkedList对象的任何东西。

#1


59  

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

从http://java.sun.com/javase/downloads/index.jsp安装Java SE开发工具包。

Once installed, you should find an archive called src.zip in the top of the JDK installation directory. The Java source code is in there.

一旦安装,您应该找到一个名为src的归档文件。压缩到JDK安装目录的顶部。Java源代码在其中。

The file is java/util/LinkedList.java.

文件的java / util / LinkedList.java。

update: You may also like to visit the online OpenJDK Source repository. See this answer below.

更新:您也可以访问在线的OpenJDK源存储库。请参阅下面的答案。

#2


18  

You have the source in the docjar:

你在docjar中有来源:

LinkedList.java (from the openjdk-7)

LinkedList。java(openjdk 7)

#3


10  

The sources are hosted at hg.openjdk.java.net. You can find the library sources for a specific JDK version under src/share/classes. For example, the JDK 8 source for java.util.LinkedList is located at:

源代码托管在hg.openjdk.java.net上。您可以在src/share/类下找到特定JDK版本的库源。例如,java.util的JDK 8源代码。LinkedList位于:

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

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

You can follow the instructions here to explore the source.

您可以按照这里的说明来探索源代码。

#4


3  

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

如前所述,您有一个src。如果在安装过程中选择了Sun JDK,则使用它安装zip文件。此外,如果您使用eclipse并将JDK添加到JRE列表中,它将自动将源代码附加到jar中,如果您尝试使用Ctrl+Shift+T (open Type)打开类,您将输入LinkedList,它将显示类的代码。

#5


3  

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

如果您有一个JDK,您可以在src中找到源代码。zip文件。

If you have an IDE, you can just ctrl+click or similar on the class/method you want to see the definition of.

如果你有一个IDE,你可以在你想要看到的类/方法上按ctrl+click或者类似的方法。

#6


3  

grepcode.com has source code of almost all opensource projects. It also provides common IDE features like find usages, derived types, etc.

grepcode.com拥有几乎所有开源项目的源代码。它还提供了常见的IDE特性,如查找用法、派生类型等。

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

在这里,您可以找到LinkedList源代码:http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8u40-b25/java/util/LinkedList.java/

#7


2  

Here:

在这里:

http://hg.openjdk.java.net/

http://hg.openjdk.java.net/

#8


1  

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

我想说从OpenJDK存储库开始,但是我没有看到LinkedList对象的任何东西。