I like to be sure that everything will work just by copying the contents of the Java folder and setting the environment variables.
I usually run the installer in a virtual machine, zip the \java folder contents, go back to a snapshot of the virtual machine, and then unzip the compressed file.
I couldn’t find a place where the latest JRE / JDK is available as a zip file…
Alternately, is it safe to assume that exe installer from sun just will just unzip the whole thing, without messing around with the registry, environment variables, etc…?
Related: Installing Java manually on Windows?
You can download a Java Portable from PortableApps.com. It will not change your system settings. You can put it on your USB stick.
UPD: for those who needs JDK there’s an open-source project OpenJDK Portable
JDK is not available as a portable ZIP file, unfortunately. However, you can follow these steps:
- Create working JDK directory (
C:\JDKin this case)
- Download latest version of JDK from Oracle (for example
- Download and install 7-Zip (or download 7-Zip portable version if you are not administrator)
- With 7-Zip extract all the files from
jdk-XuXX-windows-x64.exeinto the directory
- Execute the following commands in
- Execute the following commands in
for /r %x in (*.pack) do .\bin\unpack200 -r "%x" "%~dx%~px%~nx.jar"(this will convert all
- Copy all contents of
C:\JDK\.rsrc\1033\JAVA_CAB10\toolswhere you want your JDK to be
PATHmanually to point to your JDK dir and its BIN subdirectory.
- Create destination folder where you can RWX (e.g.
- Download jdk exe from Oracle (e.g.
- Unzip the
tools.zipfound inside it into the destination folder
for /r %x in (*.pack) do .\bin\unpack200 -r "%x" "%~dx%~px%~nx.jar"
This solution works for JDK 8 too, without Admin rights.
Here is a good, but a little complex, way:
Stage 1: MSI & CAB from native installation file
Download the JRE or JDK from the Oracle (Sun) website. This method will work on any version and on SDK or JRE.
Run and wait for the installer to load. Minimize the window.
In Windows 7, you should browse to this location:
C:\Users\ YOUR_USER_NAME \AppData\LocalLow\Sun\Java
There, you will have a few MSI and CAB files.
Stage 2: easily extract the MSI & CAB using uniextract
Use WinRar or any un-RAR program available to you, and extract uniextract161_noinst.rar anywhere.
Stage 3: finally, extract the inner container named core.zip
Drag & drop jdk1.6.0_31.msi or jre1.6.0_31.msi on the icon of UniExtract.exe.
Select “Extract Method: MSI Administrative Installer”. Wait for the process to finish.
Enter the new created folder.
If you’ve drag-and-dropped jre1.6.0_31.msi you should have a jre1.6.0_31 folder
Follow all levels inside and you’ll see core.zip.
This is what you are after. You can just unzip it anywhere and you’ll have the content of the Java runtime or SDK without installing anything on your system.
* You can now close the installer of Java you’ve left opened in stage 1 *
The answer has been given before. It works for “jdk-8u91-windows-x64.exe” also
- Unzip with 7-zip, so we get tools.zip
In cmd move to the folder folder_name/bin and run the command
the output will be
Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/Object
this indicates that there is something messing. Actually we need to unpack all packages.
In cmd move to the folder folder_name and automatically do the unpacking by executing the command
for /r %x in (*.pack) do .\bin\unpack200 -r “%x” “%~dx%~px%~nx.jar”
Do step 3 again, if you get the output bellow, then the JDK is ready to use.
java version "1.8.0_91" Java(TM) SE Runtime Environment (build 1.8.0_91-b15) Java HotSpot(TM) 64-Bit Server VM (build 25.91-b15, mixed mode)
For JDK 8u102 things have changed, this worked for me:
- Download windows JDK exe
- Open with 7-Zip
- Dump contents into a directory %JDK-EXE%
- cmd: cd %JDK-EXE%.rsrc\1033\JAVA_CAB10
- cmd: extrac32 111
- Now have a tools.zip in directory, open it in 7-Zip
- Extract contents into a new directory %JDK-VERSION%
- cmd: cd %JDK-VERSION%
- cmd: for /r %x in (*.pack) do .\bin\unpack200 -r “%x” “%~dx%~px%~nx.jar”
src.zip is in a linux download: jdk-VERSION-linux-x64.tar.
Put a copy into %JDK-VERSION%
Now you are ready to go.
You might want to setup JAVA_HOME and PATH to point to your %JDK-VERSION% dir and its BIN subdir.
Download JAVA SE with JDK
- Download jdk from Oracle website: http://www.oracle.com/technetwork/java/javase/downloads/index.html
- Unzip the exe. For example: jdk-8u5-windows-x64.exe
- Unzip the following file: tools.zip (found under the unzipped folder) to the desired JAVA_HOME.
- Update the JAVA_HOME environment variable to point to your desired path.
Tested for version: jdk-7u60-windows-x64.exe, jdk-7u60-windows-x64.exe
Download JAVA EE with JDK
- Download jdk from Oracle website: http://www.oracle.com/technetwork/java/javaee/downloads/index.html
- Unzip the exe. For example: jdk-7u55-windows-x64.exe
- Unzip the following file: Product\Packages\jdk.zip (found under the unzipped folder) to the desired JAVA_HOME.
- Update the JAVA_HOME environment variable to point to your desired path.
Tested for version: jdk-7u55-windows-x64.exe
There is a .tar.gz file of the Java Runtime Environment (JRE) on the Oracle website for these operations systems: Windows x86, Windows x64, Linux x86, Linux x64, Mac OS X x64, Solaris x64.
Also there is the Java Development Kit (JDK): http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html.
The Windows .tar.gz. is missing, but you can just extract the .exe file with a tool like 7zip.
I found this is very useful to make Eclipse portable. 😉
This is how I do it,
Start with the exe installation and wait for the below screen,
Go to the
C:\Program Files (x86)\Java and copy your JDK to another place.
Cancel the installation by clicking ‘x’ and uninstall JDK.
Copy the copied JDK back into
C:\Program Files (x86)\Java or other folder of your choice
Download the Processing application from http://www.processing.org/download/. The zip file contains a folder called java. It includes the JDK 1.6.0_32 (version checked on 19/02/2013).
Here is a link for JDK 5 zip file.
Zulu is a certified build of OpenJDK that is fully compliant with the Java SE standard. Zulu is 100% open source and freely downloadable. Now Java developers, system administrators and end users can enjoy the full benefits of open source Java with deployment flexibility and control over upgrade timing.
More technical information on different JVMs (including Zulu) with their architectures and OS support here.
The Sun JVM is available as a MSI which is executable from a script.
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
this link contains portable zip distributions for all versions.
Thanks for asking; the JDK does not seem to interact with the Windows registry.
However, the JRE does in certain instances.
The Process described by Igor and CharlesB Works to me, since IDE’s like NetBeans and Eclipse permit specify the location of the JDK, even software like Apache Tomcat (the ZIP Distribution) use BASH – FILES to set it up (then specify the JDK location using relatives URI).
I Have a USB-HardDisk With NetBeans, Eclipse, Apache Tomcat working with a JDK in “portable mode”.
I Had a way to extract a copy of the JDK from the installers files: Install it, Copy it in other place and then uninstall it. A dirty way to extract it, but was successfull.
The place to put EXTRA – LIBS was: %PLACE_WHERE_JDK_ARE%\jre\lib\ext
helps you at least avoid the obnoxious preload installer getting straight to the SDK.
From there, I would install this in a throw-away VM, on your old crufty PC or elsewhere, then transfer the resulting
C:\Program Files (x86)\Java\jre7
(or similar) to your new machine, set the very few usual ENV variables, and there you ideally go, w/o all the marketing junk and potential tie-ins. Of course, also w/o the security from frequent automatic updates.
I discovered you can run the installer in Wine. This works:
WINEPREFIX=/home/jason/java wine jre-7u11-windows-i586.exe
Then once it is finished you can just zip up the
/home/jason/java/drive_c/Program\ Files\ \(x86\)/Java/jre7/
This should work for jdk as well
You can download SEVER JRE it contains jdk. server jre 7
- Download server-jre-< version>.tar.gz file for windows system.
- If you have 7zip tar file can be extracted by that, I used cygwin(cygwin can be installed without admin rights see this answer) to extract tar file with command
tar xzvf file.tar.gzany other tar extractor will also work
Now extracted JDK folder will be created in same folder.
The widely-upvoted answer is fine, I’ve used it for quite some time in the form of this bat file:
@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;
It requires access on the path to 7zip, and must be run in a folder alongside the JDK of your choice (it’ll find it because of the *.exe up here).
Works on 8u144, and I guess it worked from the 8u20 thing.
I did copy the JRE folder several times and it always works fine. But I am really not sure if you can just get a zip file with its contents, as the official installation install the plugins for IE, Firefox and whatsoever.
You can get jre-7u75-windows-i586.zip from the link above.
- Download from Oracle the
- Mount the disk image
- Extract the
.pkg, dragging it. Do not double-click (it will install).
- Open a terminal and
cdinto the package.
mkdir jdk-$version && cd jdk-$version
xar -xf ../JDK*.pkg
tar zxf Payload
Contents/Homefolder contains the JDK
Here’s where. Download the .gz package.
mkdir c:\JDK cd c:\JDK git clone https://bitbucket.org/ramazanpolat/jdk-8u112-windows-x64/
git clone https://bitbucket.org/ramazanpolat/jdk-8u112-windows-x86
I installed JDK 8 with the exe installer and then uninstalled JRE, I now have JDK folder with no env variable or other setting changed.
This worked just fine for me: http://www.brucalipto.org/java/how-to-create-a-portable-jdk-1-dot-7-on-windows/
Commands from tips below wrapped as batch script. Save this as unpack.bat. Then place it to dir with jdk/jre extracted files.
@echo off cd /d "%~dp0" for /r %%x in (*.pack) do .\bin\unpack200 -r "%%x" "%%~dx%%~px%%~nx.jar"
Install in sandbox, and copy the folder out.