无需安装即可在 Windows 中获取 Oracle Java 1.8

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27012722/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 03:39:39  来源:igfitidea点击:

Get Oracle Java 1.8 in windows without installing it

javawindows

提问by user1346316

Is it possible to get Java in zip format? I don't want to install it by getting .exe file.

是否可以以 zip 格式获取 Java?我不想通过获取 .exe 文件来安装它。

Is there any zip version of Java 1.8 so that I can download it and extract it and start using it in my Windows machine (64-bit processor)?

是否有 Java 1.8 的任何 zip 版本,以便我可以下载并解压缩它并开始在我的 Windows 机器(64 位处理器)中使用它?

回答by Karthikeyan Vaithilingam

You can extract the JDK folder from the Installation EXE.

您可以从安装 EXE 中提取 JDK 文件夹。

Check this linkfor the steps. The post was for JDK 1.7 it will work for JDK 1.8 also

检查此链接以获取步骤。该帖子适用于 JDK 1.7 它也适用于 JDK 1.8

Do the following.

请执行下列操作。

Steps

脚步

  1. Download JDK from Oracle
  2. Download and Install 7-zip from here
  3. Open installition exe using 7-Zip
  4. Extract the tools.zip
  5. Extract the content of tools.zip to a folder (e.g. c:\jdk).
  6. Open the extracted folder in cmd prompt.
  7. Execute for /r %x in (*.pack) do .\bin\unpack200 -r "%x" "%~dx%~px%~nx.jar"command
  8. Set JAVA_HOMEto the jdk (e.g c:\jdk) folder.
  9. Add %JAVA_HOME%/binto the PATH env variable.
  1. Oracle下载 JDK
  2. 这里下载并安装 7-zip
  3. 使用 7-Zip 打开安装 exe
  4. 解压tools.zip
  5. 将tools.zip 的内容解压到一个文件夹(例如c:\jdk)。
  6. 在 cmd 提示符下打开提取的文件夹。
  7. 执行for /r %x in (*.pack) do .\bin\unpack200 -r "%x" "%~dx%~px%~nx.jar"命令
  8. 设置JAVA_HOME为 jdk(例如 c:\jdk)文件夹。
  9. 添加%JAVA_HOME%/bin到 PATH 环境变量。

Testing

测试

Run the following command to check the installation, it will print the version of JDK.

运行以下命令检查安装,它会打印JDK的版本。

c:> javac -version
javac 1.7.0_51

NOTE:Tested with JDK 1.7 and 1.8

注意:使用 JDK 1.7 和 1.8 测试

Update 1

更新 1

Edited the answer to add the steps in the answer itself instead of the link to a blog post.

编辑了答案以在答案本身中添加步骤而不是博客文章的链接。

Update 2

更新 2

For 64-Bit please check unpack-jdk-x64.batby grabantot

对于 64 位,请检查grabantounpack-jdk- x64.bat

回答by SarthAk

If you do not have permission to unzip zip file then you cannot install java . As java does not need installation for running . You just need to give path of java.exe where it is located .

如果您无权解压 zip 文件,则无法安装 java 。由于 java 不需要安装即可运行 . 您只需要提供 java.exe 所在的路径。

In Windows it is located in C:\Program Files\Java\jdk1.8.0_05\binFor a solution you can run installer on any machine that you have permission and just copy and paste the folder of java to anywhere in your system (Machine where you have administrative rights problem) . and just set the path as by opening command prompt as set path="C:\Program Files\Java\jdk1.8.0_05\bin"java will be working as you want

在 Windows 中,它位于C:\Program Files\Java\jdk1.8.0_05\bin对于解决方案,您可以在您拥有权限的任何机器上运行安装程序,只需将 java 文件夹复制并粘贴到系统中的任何位置(机器您有管理权限问题的地方)。并通过打开命令提示符将路径设置set path="C:\Program Files\Java\jdk1.8.0_05\bin"java 将按您的意愿工作

回答by Darrel Lee

I was looking for a solution to this as well. I'm not sure why the OP wanted to do this. I'm just trying to get a newer version of java for new development while not interfering with an older Java install which a legacy application requires (I'd like to update the legacy app, but it's not an option, now)

我也在寻找解决方案。我不确定为什么 OP 想要这样做。我只是想获得更新版本的 java 以进行新的开发,同时不干扰旧版应用程序所需的旧版 Java 安装(我想更新旧版应用程序,但现在不是一个选项)

I think the hack I am going to try is this:

我想我要尝试的黑客是这样的:

  1. Install 1.8
  2. Take a copy of the install folder
  3. Uninstall 1.8
  4. Reinstall / Repair 1.7
  5. restore the copy of 1.
  1. 安装 1.8
  2. 复制安装文件夹
  3. 卸载 1.8
  4. 重新安装/修复 1.7
  5. 恢复 1 的副本。

I'm sure if I had a better understanding of what the install is doing, this would not be necessary.

我敢肯定,如果我对安装正在做什么有更好的了解,这将是不必要的。

回答by Deepak

The following worked for me (I had JDK 1.8 installed and needed the 32 bit version as well):

以下对我有用(我安装了 JDK 1.8 并且也需要 32 位版本):

  • Verify the current version with java -version
  • Assuming a different version (minor or major is being installed), download the relevant JDK installable from Oracle and run it. In the first dialog, specify a different folder than the default location (might work with the default one as well), then select Next. It will extract the files there in this folder, then it will asl for the folder where the JRE is to be installed. Simply close the installer, now you should have just the JDK in the specified folder.
  • Rerun java -version, it should give you the same version as earlier.
  • Worst case, if it shows the newer version, go to your system path (Right click My Computer (or This PC) -> Properties -> Advanced system settings -> Advanced tab -> click on Environment variables button) and remove the Oracle javapath entry (From the Path variable in the bottom part of the window). The add the older java version's bin folder to the path variable in the beginning.
  • 使用 java -version 验证当前版本
  • 假设不同的版本(正在安装次要或主要版本),从 Oracle 下载相关的 JDK 可安装并运行它。在第一个对话框中,指定一个不同于默认位置的文件夹(也可以使用默认位置),然后选择下一步。它将提取此文件夹中的文件,然后将其作为要安装 JRE 的文件夹。只需关闭安装程序,现在您应该只有指定文件夹中的 JDK。
  • 重新运行 java -version,它应该为您提供与之前相同的版本。
  • 最坏的情况,如果它显示较新的版本,请转到您的系统路径(右键单击我的电脑(或这台电脑)-> 属性-> 高级系统设置-> 高级选项卡-> 单击环境变量按钮)并删除 Oracle javapath条目(来自窗口底部的 Path 变量)。将较旧的java 版本的bin 文件夹添加到开头的路径变量中。

回答by SharpC

I had a spare virtual machine hanging around (if not you could build one or maybe even download one) so I:

我有一台备用虚拟机(如果没有,您可以构建一个甚至下载一个),所以我:

  • installed the Oracle JDK in the guest
  • copied the jdk folder from the guest to the host
  • added a JAVA_HOMEenvironment variable.
  • 在来宾中安装了 Oracle JDK
  • 将jdk文件夹从guest复制到host
  • 添加了一个JAVA_HOME环境变量

The operating systems obviously have to be close (not sure how close, I used Windows Server 2008 64 bit guest on a Windows 10 64 bit host and it seemed to work).

操作系统显然必须接近(不确定有多接近,我在 Windows 10 64 位主机上使用了 Windows Server 2008 64 位来宾,它似乎可以工作)。

Was a quick fix for me as I didn't want a full install and wanted to remove it afterwards.

对我来说是一个快速修复,因为我不想完全安装并想在之后将其删除。