IT

Java JDK 소스 코드는 어디에서 찾을 수 있습니까?

lottoking 2020. 6. 16. 08:00
반응형

Java JDK 소스 코드는 어디에서 찾을 수 있습니까? [닫은]


Java API의 메소드가 무엇을하는지보고 싶습니다. JDK 소스 코드를 원합니다. Linux를 다시 설치하기 전에 src.zip모든 공식 소스 코드 가 포함 된 패키지가 있었습니다 . 이 파일이 어디에 있는지 Eclipse에 알려 주어야했고 코드를 볼 수있었습니다. 하지만 이제는 더 이상 파일이 없습니다 ...

그래서 문제는 : 어디서 찾을 수 있습니까?


원하는 버전을 말하지 않았지만 JDK 7JDK 6 과 함께 JDK 8 소스 코드의 아카이브를 여기 에서 다운로드 할 수 있습니다 .

또한 Mercurial 리포지토리 ( 8 , 7 , 6)를 찾아 보거나 복제 할 수 있습니다 .


JDK를 사용하여 이미 소스 코드를 얻었을 가능성이있는 경우, 해당 위치를 찾는 것이 중요합니다. JDK 폴더에 소스 코드가없는 경우 :

sudo apt-get install openjdk-7-source

OSX Folks, homebrew 공식에서 검색하십시오.

우분투에서 위의 명령은 souce 파일을 / usr / lib / jvm / openjdk-7 /에 넣습니다.

좋은 소식은 Eclipse가 이미 당신을 데려 갈 것입니다 (Eclipse를 Java 소스 코드에 바인딩하는 방법).

주황색 버튼을 따라

여기에 이미지 설명을 입력하십시오 여기에 이미지 설명을 입력하십시오 여기에 이미지 설명을 입력하십시오


안타깝게도이 문서를 작성할 때 Windows 설명서를 다운로드 할 때 JDK 7 또는 8 설치 디렉토리에 src.zip 없습니다 .

Note: perhaps this happens because many of us don't actually run the install .exe, but instead extract it. Many of us don't run the Java install (the full blown windows install) for security reasons....we just want the JDK put someplace out of the way where potential viruses cannot find it.

But their policy regarding the windows .exe (whatever it truly is) is indeed nuts, HOWEVER, the src.zip DOES exist in the linux install (a .tar.gz). There are multiple ways of extracting a .tar and a .gz, and I prefer the free "7Zip" utility.

  1. download the Linux 64 bit .tar.gz
  2. use 7zip to uncompress the .tar.gz to a .tar
  3. use 7zip to extract the .tar to the installation directory
  4. src.zip will be waiting for you in that installation directory.
  5. pull it out and place it where you like.

Oracle, this is really beyond stupid.


I had this problem with my Ubuntu.

All I needed to do to get sources for my java insallation was:

sudo apt-get install sun-java6-source 

The JDK 1.6 I'm currently using on OSX Mountain Lion did not come with a src.zip either, and as far as i can tell there is no supported OSX JDK for 1.6 available anymore.

So I downloaded the OpenJDK source (using the links from the accepted answer (+1)) then ran:

cd ~/Downloads
mkdir jdk6src
cd jdk6src
tar xf ../openjdk-6-src-b27-26_oct_2012.tar.gz
cd jdk/src/share/classes
jar cf /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/src.jar *

(your file names and paths may vary...)

Associate that src.jar with the appropriate Java platform in your IDE and you should be good to go.

There are some discrepancies between the OpenJDK source and the JDK I'm currently running (line numbers don't match up in the debugger, for one), but if all you want is a zip/jar to point your IDE to for the relatively few cases you need to peek at some code to understand how something works, then this should do the trick.


This file is contained in the standard JDK download. Also your Linux system probably have JDK in the repository. In my Ubuntu Linux file is located here: /usr/lib/jvm/java-6-sun-1.6.0.20/src.zip


In JDK 8 source can be found in /src.zip. Now in some intermediate releases this zip was missing but again it is available.여기에 이미지 설명을 입력하십시오

make sure that you select source as well from installation wizard.


Here the official link for jdk source. http://www.oracle.com/technetwork/java/javase/downloads/index.html (you may need to scroll to the bottom of the page)


Well, I opened terminal in my Mac and type: "echo $JAVA_HOME" then I got the directory, went there and found src.zip


Yes!! Got it!

I downloaded the Java Developer Kit (JDK) from sun.com for Linux. There was src.zip in. But first I uninstalled all Java packages with synaptic.


The official link no longer offers the original source code. The official link and casual google searches will land you with open jdk. Open jdk causes problems with android build unless the build script files are modified. The original package can be found here:

sudo add-apt-repository "deb http://ppa.launchpad.net/ferramroberto/java/ubuntu oneiric main"

이 저장소에는 여전히 sun-java6-source 패키지가 있습니다. 크레딧 : http://pulasthisupun.blogspot.com/2012/05/installing-sun-java-6-with-apt-get-in.html

참고 URL : https://stackoverflow.com/questions/2896727/where-to-find-java-jdk-source-code

반응형