我希望通过复制Java文件夹的内容并设置环境变量来确保一切都能正常工作。

我通常在虚拟机中运行安装程序,压缩\java文件夹内容,回到虚拟机的快照,然后解压缩压缩文件。

我找不到一个地方有最新的JRE / JDK压缩文件…

http://java.sun.com/javase/downloads/index.jsp

http://download.java.net/jdk6/

另外,假定sun的exe安装程序只是解压缩整个文件,而不会弄乱注册表、环境变量等等,这是否安全?

相关:在Windows上手动安装Java ?

-- 经过这么长时间,我找到了这个网站,似乎正是我要找的(2018-05-22)


当前回答

You can just use 7zip (or another similar app) to get the dirs inside the core.zip file that's bundled in the installer. Just use 7zip to browse the exe, you'll see a core.zip file which has all the files that usually go inside "jreX" dir (where X is the major version number). As for setting env variables and the such, you can follow the other answers. If all you want is a portable jre (for example, you can run your jars by using java.exe jarfile or javaw.exe jarfile) then this solution will do. This is very similar to copying the jre dir from one place to another

其他回答

创建目标文件夹,您可以RWX(例如C:\jdk8) 从Oracle下载jdk exe(例如:jdk-8u72-windows-x64.exe) 将其中的tools.zip解压到目标文件夹中 在cmd.exe中运行: cd C: \ jdk8 在(x / r % * .pack)。\ bin \ unpack200 - r“% x”“% ~ dx % ~ px % ~ nx.jar”

这个解决方案也适用于没有Admin权限的JDK 8。

得到广泛好评的答案很好,我已经用了很长一段时间,以这个bat文件的形式:

@ECHO OFF

SETLOCAL ENABLEDELAYEDEXPANSION

SET ROOT=%cd%

REM Get the tools.zip from the innards of the installer
7z e *.exe .rsrc/1033/JAVA_CAB10/111
7z e 111 7z x tools.zip
REM Extract all
7z x -aoa tools.zip -ojdk

del tools.zip
del 111

REM Searching directory structure from root for subfolders and zipfiles.
FOR /F "delims==" %%d IN ('dir /ogne /ad /b /s "%ROOT%"') DO (
    echo Descending into %%d
    FOR /F "delims==" %%f IN ('dir /b "%%d\*.pack"') DO (
        echo Extracting "%%d\%%f"
        REM Extract all packs into jars.
        jdk\bin\unpack200 -r  "%%d\%%f" "%%d\%%~nf.jar"
    )
)

ENDLOCAL
pause;

它需要访问7zip的路径,并且必须在你选择的JDK的文件夹中运行(它会找到它,因为上面有*.exe)。

在8u144上也能用,我猜在8u20上也能用。

针对Windows x86、Windows x64、Linux x86、Linux x64、Mac OS X x64、Solaris x64等操作系统,Oracle网站上有JRE的.tar.gz文件。 参见:http://www.oracle.com/technetwork/java/javase/downloads/jre8 -下载- 2133155. - html

还有Java开发工具包(JDK): http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html。 Windows .tar.gz。没有,但是您可以用7zip之类的工具提取.exe文件。

我发现这对于使Eclipse可移植非常有用。: -)

你可以从Azul Systems下载一个可移植的Zulu .zip存档,它是针对Windows, Linux (RHEL, SUSE, Debian, Ubuntu, CentOS)和Mac OS X的OpenJDK的构建。

Zulu是OpenJDK的认证版本,完全符合Java SE标准。Zulu是100%开源的,可以免费下载。现在,Java开发人员、系统管理员和最终用户可以享受开源Java的全部好处,包括部署灵活性和对升级时间的控制。

更多关于不同jvm(包括Zulu)及其体系结构和操作系统支持的技术信息。

从http://www.processing.org/download/下载Processing应用程序。zip文件包含一个名为java的文件夹。它包括JDK 1.6.0_32(版本检查于19/02/2013)。