简体   繁体   English

解压缩JDK安装程序时没有“src.zip”

[英]No “src.zip” when extracting JDK installer

I have followed this procedure : How can I get the latest JRE / JDK as a zip file rather than EXE or MSI installer? 我遵循了这个过程: 如何将最新的JRE / JDK作为zip文件而不是EXE或MSI安装程序? . In order to get JDK w/o admin rights. 为了获得没有管理员权限的JDK。 However, I still miss the source archive "src.zip". 但是,我仍然想念源存档“src.zip”。

When I open the installer with 7-Zip, it only shows "tools.zip" file. 当我用7-Zip打开安装程序时,它只显示“tools.zip”文件。 Here is the command-line output: 这是命令行输出:

C:\Users\mlogan\Downloads>7z.exe l jdk-7u45-windows-i586.exe

7-Zip 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18

Listing archive: jdk-7u45-windows-i586.exe

--
Path = jdk-7u45-windows-i586.exe
Type = PE
CPU = x86
Characteristics = Executable 32-bit
Created = 2013-10-08 17:03:06
Physical Size = 129487776
Headers Size = 1024
Checksum = 129505985
Image Size = 129503232
Section Alignment = 4096
File Alignment = 512
Code Size = 62976
Initialized Data Size = 129425408
Uninitialized Data Size = 0
Linker Version = 10.0
OS Version = 5.1
Image Version = 0.0
Subsystem Version = 5.1
Subsystem = Windows GUI
DLL Characteristics = Relocated NX-Compatible TerminalServerAware
Stack Reserve = 1048576
Stack Commit = 4096
Heap Reserve = 1048576
Heap Commit = 4096
Image Base = 4194304
----
Path = .rsrc\JAVA_CAB10\111
Size = 83877914
Packed Size = 83877914
--
Path = .rsrc\JAVA_CAB10\111
Type = Cab
Method = LZX
Blocks = 1
Volumes = 1

Date       Time     Attr          Size   Compressed  Name
------------------- ----- ------------ ------------  ------------------------
2013-10-08 08:42:32 ....A    181321555               tools.zip
------------------- ----- ------------ ------------  ------------------------
                             181321555    129487776  1 files, 0 folders

Have you any idea on how to retrieve the source archive ? 您对如何检索源存档有任何想法吗?

According to the latestest answer by Piero Ottuzzi in his post http://www.brucalipto.org/java/how-to-create-a-portable-jdk-1-dot-8-on-windows , Oracle seems to no longer include src.zip from update 45. You could always use tools.zip to have a portable JDK. 根据Piero Ottuzzi在他的帖子http://www.brucalipto.org/java/how-to-create-a-portable-jdk-1-dot-8-on-windows中的最热门答案,Oracle似乎不再包括来自更新45的src.zip。您可以始终使用tools.zip来获得可移植的JDK。

Steps to follow on Windows to have a portable JDK: 在Windows上使用便携式JDK的步骤:

  1. Download the installer, eg. 下载安装程序,例如。 jdk-8u51-windows-x64.exe, into a folder, eg. jdk-8u51-windows-x64.exe,进入文件夹,例如。 "downloads", that contains 7z.exe. “downloads”,包含7z.exe。

  2. Extract tools.zip from the installer with 7-Zip: open a command prompt and type 使用7-Zip从安装程序中提取tools.zip:打开命令提示符并键入

     D:\\downloads>7z x jdk-8u51-windows-x64.exe 
  3. Extract the content of tools.zip to a folder, say "jdk", with 7-Zip: type in the command prompt 将tools.zip的内容解压缩到一个文件夹,比如“jdk”,在命令提示符下输入7-Zip:type

     D:\\downloads>7z x tools.zip -ojdk 
  4. Move to the folder jdk and transform .pack files to .jar files: type in the command prompt 移动到文件夹jdk并将.pack文件转换为.jar文件:在命令提示符下键入

     D:\\downloads>cd jdk D:\\downloads\\jdk>for /r %x in (*.pack) do .\\bin\\unpack200 -r "%x" "%~dx%~px%~nx.jar" 

The folder jdk is the wanted portable jdk. 文件夹jdk是想要的便携式jdk。 To test it, type in the command prompt: 要测试它,请在命令提示符下键入:

D:\downloads\jdk>.\bin\java -version

You would get 你会得到的

java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)

正如@PeterLawrey建议的那样,最好的方法是使用Linux发行版。

You can extract src.zip by following the steps mentioned below. 您可以按照下面提到的步骤提取src.zip

Note: Steps are mentioned for jdk-7u80-windows-x64.exe . 注意:提到了jdk-7u80-windows-x64.exe的步骤 Steps for JDK7 and JDK8 (for both 32bit and 64bit) are similar. JDK7和JDK8(32位和64位)的步骤类似。

Step 1 步骤1

Execute the offline installer jdk-7u80-windows-x64.exe . 执行脱机安装程序jdk-7u80-windows-x64.exe Let the setup screen appear. 让设置屏幕出现。 Don't press the Next button. 不要按“ 下一步”按钮。

在此输入图像描述

Step 2 第2步

Now now in file explorer go to the directory 现在在文件资源管理器中转到该目录

C:\Users\UserName\AppData\LocalLow\Sun\Java

where UserName is replaced by actual user name. 其中UserName被实际用户名替换。

Note: For JDK 8 use the directory 注意:对于JDK 8,请使用该目录

C:\Users\UserName\AppData\LocalLow\Oracle\Java

在此输入图像描述

Now the MSI and CAB files for JDK 7u80 64 bit installation will be in the directory jdk1.7.0_80_x64 . 现在,JDK 7u80 64位安装的MSICAB文件将位于jdk1.7.0_80_x64目录中。

Note: For 32 bit JDK 7u80 installation the corresponding directory will be jdk1.7.0_80 . 注意:对于32位JDK 7u80安装,相应的目录将为jdk1.7.0_80

Step 3 第3步

Copy this folder to some other suitable location. 将此文件夹复制到其他合适的位置。 Now cancel the JDK installation. 现在取消JDK安装。

Step 4 第4步

Now in the copied folder you will find following files: 现在在复制的文件夹中,您将找到以下文件:

  1. jdk1.7.0_80.msi - MSI for JDK installation. jdk1.7.0_80.msi - 用于JDK安装的MSI。
  2. sj170800.cab - Contains files required for stand alone JRE installation. sj170800.cab - 包含独立JRE安装所需的文件。
  3. ss170800.cab - Contains file src.zip . ss170800.cab -包含文件src.zip。
  4. st170800.cab - Contains file tools.zip . st170800.cab - 包含文件tools.zip
  5. sz170800.cab - Contains file COPYRIGHT . sz170800.cab - 包含文件COPYRIGHT

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM