22

I installed the JDK8u40, but only find the javafx-src.zip.

Where can I find the source code for JDK? The src.zip?

Below is what I get after installation:

And btw, I didn't see the installation wizard! This is quite strange.

enter image description here

ADD 1

Today I tried several Java installation packages. All are downloaded from Oracle official site.

  • jdk-6u45-windows-i586.exe
  • jdk-7u75-windows-i586.exe
  • jdk-8u20-windows-i586.exe
  • jdk-8u25-windows-i586.exe
  • jdk-8u31-windows-i586.exe
  • jdk-8u40-windows-i586.exe

Both 6u45 and 7u75 installed well on my box. I can see the install wizard. And the src.zip is installed.

But 8u25 ~ 8u40 all installed silently. And no src.zip file is installed because I have no chance to select it in the wizard.

I am not sure if this is my fault or someone at Oracle made a mistake.

As @SubOptimal commented, the /s option indicates a silent install. I am wondering if there's an option to force the GUI install wizard to open.

I am using Windows 7 Enterprise x64 Build 7601 SP1

smwikipedia
  • 61,609
  • 92
  • 309
  • 482
  • I've found it in the folder where the jdk is installed. Are you sure you've checked right? – Luiggi Mendoza Mar 25 '15 at 14:49
  • @LuiggiMendoza Unfortunately, I only find the javafx-src.zip. Please see my attached screenshot. – smwikipedia Mar 25 '15 at 14:51
  • Try to reinstall the JDK, it should really be there. – Crazyjavahacking Mar 25 '15 at 14:52
  • @Crazyjavahacking I have tried several times. Still no luck... And I even tried with JDK8u25, no src.zip, either... Is there any error log to check? – smwikipedia Mar 25 '15 at 14:53
  • 1
    Found this: http://stackoverflow.com/questions/22732226/where-do-i-find-the-java-jdk-source-code-for-jdk-1-8 – Konstantin Yovkov Mar 25 '15 at 14:53
  • Well, I have jdk1.8.0, jdk1.8.0_20 and jdk1.8.0_40 in Windows 7 64 bits and **all of them** have the src.zip file. Probably it was a mistake to not include it in Windows 32 bit version. – Luiggi Mendoza Mar 25 '15 at 14:55
  • @LuiggiMendoza Yes, I am using Windows 32 bit version. – smwikipedia Mar 25 '15 at 14:56
  • What version of windows: XP, Millenium, 98, 95? Please be specific enough with the info to spot the error. – Luiggi Mendoza Mar 25 '15 at 14:57
  • From where do you got the installer? – SubOptimal Mar 25 '15 at 14:59
  • @LuiggiMendoza Win7 64bit. Btw, I didn't see the installation wizard. Everything is silently done. I never expected this. – smwikipedia Mar 25 '15 at 14:59
  • 1
    @SubOptimal Oracle official site http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html – smwikipedia Mar 25 '15 at 14:59
  • If you're using Windows 7 64 bits, then why do you install JDK 32 bits edition? And again, I installed the JDK 64 bits and the src.zip file is there. – Luiggi Mendoza Mar 25 '15 at 15:00
  • @smwikipedia If you run the `jdk-8u40-windows-i586.exe` you should see the installation wizard. Could it be that you only extract the installer for example with `7z` and the the `tools.zip` inside? – SubOptimal Mar 25 '15 at 15:12
  • 1
    @smwikipedia Could you try the following if it solves the problem `jdk-8u40-windows-i586.exe /s ADDLOCAL="ToolsFeature,SourceFeature,PublicjreFeature"`. – SubOptimal Mar 25 '15 at 15:23
  • @SubOptimal Your install command works. Now I can see the `src.zip`. But I still cannot see the installation wizard. And btw, how can I know which installation options such as ADDLOCAL are available? I hope there's one to turn on the wizard. – smwikipedia Mar 26 '15 at 01:02
  • @smwikipedia For sure you will not see the installation wizard running the installer that way. As this is a silent installation. For available options have a look here [Windows JDK install](http://docs.oracle.com/javase/8/docs/technotes/guides/install/windows_jdk_install.html#sthref20) – SubOptimal Mar 26 '15 at 06:46
  • @SubOptimal Yes, your command specify the `/s` for silent install. What I did is double click the install file. Still no wizard. – smwikipedia Mar 27 '15 at 06:06
  • possible duplicate of http://stackoverflow.com/questions/22732226/where-do-i-find-the-java-jdk-source-code-for-jdk-1-8http://stackoverflow.com/editing-help#comment-formatting refer http://www.oracle.com/technetwork/articles/java/ea-jsp-142245.html – gujralam Apr 08 '15 at 21:00
  • Hmmm... My JDK has the source. – CaffeineToCode Apr 11 '15 at 16:00
  • @CaffeineToCode Are you using exactly the same context with me? Which setup package? – smwikipedia Apr 12 '15 at 01:55
  • JDK 8u40 on Windows 7. I'm not sure why your wizard ran silently, it gave me the usual options. – CaffeineToCode Apr 12 '15 at 14:45

6 Answers6

21

Make sure the Source code is not disabled when downloading.

enter image description here

Then as you can see on the picture, selecting "Source Code" will tell you exactly where it is located.

enter image description here

Notice that I've downloaded the 32 bits version to make sure to reproduce the same use case as you.


Edit

As per your new edits and comments, it seems what you want to know now is why you don't see the installation wizards. I'm pretty sure this is due to old-set registry key.

Run the following command

reg query hklm\software\microsoft\windows\currentversion\installer\UserData\S-1-5-18\Products /f "java" /s | find "HKEY_LOCAL_MACHINE"

Now, navigate to each of the returned path browsing with regedit and delete their entire parent (the big hexa number).

Re-try the installation and I'm pretty sure you will see the wizard.


As for the sources, Oracle documentation specify how to download them in silent mode.

jdk.exe /s ADDLOCAL="SourceFeature"
Jean-François Savard
  • 20,626
  • 7
  • 49
  • 76
  • Many thanks for your update. But unfortunately, I still didn't see the wizard. My steps: 1) Uninstall all previously installed JDK. 2) Run your reg query command and delete all the results. 3) Reboot the computer 4) Install the JDK 8u40. The JDK wizard still doesn't show. The JDK8 installation seems to have subtle difference with JDK7. – smwikipedia Apr 06 '15 at 02:20
  • @smwikipedia Can you confirm that only the JDK 8 wizard does not show, and that any other installer's wizard will show (not limited to jdk installation) ? – Jean-François Savard Apr 06 '15 at 03:12
  • Yes, as far as I tried, I can confirm that 6u45 and 7u75 show wizard correctly. All JDK 8 wizard fail to show. Now I have to live with 7u75. – smwikipedia Apr 06 '15 at 09:26
  • @smwikipedia Then I would try to delete everything related to jdk 8 in `HKEY_LOCAL_MACHINE\software\JavaSoft` – Jean-François Savard Apr 06 '15 at 15:30
  • @smwikipedia Any feedback on this suggestion ? – Jean-François Savard Apr 07 '15 at 14:42
  • Sorry Jean, I haven't got time to try it yet. But I didn't see many config entries in the location you specified. I will try it later. Thanks. – smwikipedia Apr 08 '15 at 02:15
  • @smwikipedia No proble, any update on this since then ? – Jean-François Savard Apr 09 '15 at 20:49
  • @smwikipedia Then I'm out of idea, it's hard without having access to the machine. Would you be able to post the windows event log after you run the installer ? – Jean-François Savard Apr 11 '15 at 05:13
  • Thanks for your patient help. I will give my bounty to you. I can live with 7u75 for now. :) – smwikipedia Apr 12 '15 at 01:56
  • @smwikipedia You're welcome :). Feel free to ping me if ever you want to continue inspecting this. – Jean-François Savard Apr 12 '15 at 01:57
  • 2
    What worked for me with 8u102 was: 1. Fully uninstall previous installation of u102 in Program Manager 2. Use full command from your link: `jdk.exe /s ADDLOCAL="ToolsFeature,SourceFeature,PublicjreFeature"` 3. Fun and profit – avalancha Sep 14 '16 at 10:43
  • I've seen a number of Windows 10 machines which seem to only run the Java 8 installer in silent mode by default. It appears to not startup, but the install continues silently and you'll see it installed to the target dir. I'll try clearing the registry key next time I see this. – Kevin Hooke Nov 22 '17 at 22:15
20

This is the way I got the src folder from jdk-8u172-windows-x64.exe file without installing.

Step1: Download jdk-8u172-windows-x64.exe file (Java SE Development Kit 8u172) from oracle site

Step2: Extract it and navigate to the path: \jdk-8u172-windows-x64.rsrc\1033\JAVA_CAB9

Step3: Right click on file named "110" and extract it.

You will get the src.zip file.

It took me little while to figure this out. I hope it will help others.

Enjoy debugging Good Code!

S Kumar
  • 555
  • 7
  • 21
  • How can we extract exe file – Bharat Aug 18 '18 at 06:37
  • 1
    Use 7-Zip tool to extract the .exe file. – S Kumar Aug 18 '18 at 14:11
  • good solution, found **arrays.java** here: **jdk-8u231-windows-X64\.rsrc\1033\JAVA_CAB9\110~\src\java\util** but can we find the **src.jar** file to give that to, as an attachment, to eclipse when asked for, why this is not extracted or installed by default in the right directory when installing the JDK ? – HDJEMAI Dec 29 '19 at 23:50
  • Attaching with this file helps: **jdk-8u231-windows-x64\.rsrc\1033\JAVA_CAB9\110~\src.zip** – HDJEMAI Dec 30 '19 at 00:03
2

I don't know why/where the src.zip is, but as an alternative, if all you want is the source and somehow the proposed method doesn't work for you, you could always pull directly from the JDK8u40 source tree.

You will need Mercurial instead of Git. This link talks about the hg clone command

Quoting from the OpenJDK Java.net site

The corresponding master forest jdk8u can be cloned using this command: hg clone http://hg.openjdk.java.net/jdk8u/jdk8u;cd jdk8u;sh get_source.sh .

In addition, the source code for the last release, 8u40, is available by cloning the 8u40 master forest : http://hg.openjdk.java.net/jdk8u/jdk8u40. The final build of that release was tagged as jdk8u40-b25.

There are differences between OpenJDK and Oracle's, though subtle

Community
  • 1
  • 1
matrixanomaly
  • 6,627
  • 2
  • 35
  • 58
0

download JDK 8 from following link

http://www.oracle.com/technetwork/java/javase/jdk-8-readme-2095712.html

src.zip comes in-built with it

gujralam
  • 187
  • 1
  • 12
0

if you JDK installer silently skips installing the source. just open the control panel > programs an features and find Java. Right click on it and select change and then select the source (option) ;)

enter image description here

Mr.Q
  • 4,316
  • 3
  • 43
  • 40
  • Be careful with this method. Do not select "Uninstall" because it will uninstall Java. It's kind of misleading because I'm used to some Uninstallers giving you the option to modify the installation. Learned the hard way – TheRealChx101 May 15 '19 at 23:22
0
  1. Download the JDK
  2. Run the Installer, but stop right away
  3. Extract src.zip from C:\Users\<your_username>\AppData\LocalLow\Oracle\ss180121.cab

You can extract .zip from .cab with tool like 7Zip

Taken from