Installing JDK without administrator privileges

Oracle changed the package format in update 102 as pointed by @Webrjn on a previous answer at this question, but the unpack method still works with two more unzip actions:

enter image description here

  1. The installation executable of the JDK is a zipped file, so just unzip it with 7z to any folder you want.
  2. Go to the directory .rsrc/1033/JAVA_CAB10/.
  3. The only file there is 111, which is also a zipped file containing tools.zip. Unzip it to get tools.zip.
  4. So now perform the original unpack process, by unzipping tools.zip to your desired java installation path.
  5. Open a windows command prompt and run:

    for /r %i in (*.pack) do .\bin\unpack200.exe -r -v %i %~pi%~ni.jar
    

    The unpack200 program complains about garbage at the end of the files, but the unpacked jars are tested ok by 7z.

  6. Java source src.zip is within the file 110 located inside .rsrc/1033/JAVA_CAB9.

By the way, update 101 only contains the tools.zip file and can be installed with the previous unpack method.


Here are all the steps that got the JDK installed on Windows 7 without admin rights.

  1. You need the cabextract program to extract the installer files. I tried 7zip but it didn't extract the cab properly. Instead, I used cygwin. You can get the setup.exe program from their website, but you must rename it because Windows assumes that anything called "setup" requires admin rights. I renamed it to cygwin.exe. Run that. It'll ask you where to install. I chose the cygwin directory in my home directory. When the pop-up asks you which programs to install, type "cabinstall" in the search bar. Expand the "Archive" section and make sure the "cabinstall" is not set to "skip". (Click the "skip" text until the highest number shows.) Proceed with install. This takes a few minutes.

  2. Optional: Add cygwin\bin to your path. Do this from control panel, user accounts, change my environment variables, edit PATH.

  3. Download the JDK. I downloaded jdk-6u45-windows-x64.exe.

  4. In the directory where that file is: mkdir tmp

  5. cd tmp

  6. cabextract ..\jdk-6u45-windows-x64.exe

  7. Make a new directory for the actual JDK. I used jdk in my home directory.

  8. Extract the tools.zip file into that. It comes with the Java runtime, so you don't need the other files in the original cab, such as jre.msi.

  9. Unpack all the .pack files. You can do that manually by running the bin/unpack200 program on them, or use bash (if you installed cygwin above):

    1. bash

    2. for f in $(../cygwin/bin/find . -name "*.pack"); do bin/unpack200 $f ${f%.*}.jar; done

  10. Add jdk/bin to your PATH (see step 2 above).


Starting with Java SE 7u21, Oracle offers a so-called Server JRE for download. This is a standard .tar.gz archive that you can extract anywhere on your computer. Although the download is called JRE, it contains a "normal" JDK subdirectory (including the javac compiler etc.).

Instructions:

  • download the "Server JRE" from Java download site
  • extract the .tar.gz
  • add the bin subdirectory to your PATH

Here is a workaround to install java without admin privileges or without administrator password. For this you need cygwin installed which does not require admin privileges. In the utils make sure you select cabextract.exe to install it.

Fireup cygwin bash shell.

Type cabextract jdk1.6.exe <-- jdk file name

this will extract all the files into the current directory.

Move tools.zip to a new directory and unzip it using cygwin or windows explorer. This will be your java directory.

Hint: Try to subsitite 7zip instead of cabextract and cygwin. If it works it will be much faster.

Edit: This doesn't get you a working JDK with the latest versions of jdk 6 and 7. Many of the jar files (eg rt.jar) are compressed so they need to be decompressed using unpack200.

Just go through each directory looking for files with a .pack extension and unpack them using unpack200, eg: .\jre\bin\unpack200 .\jre\lib\rt.pack .\jre\lib\rt.jar

This allows you to run java programs however I still had trouble with Eclipse as there was some issue with annotations, so there's probably another step that is missing.

In the answers to this similar question on Superuser is available a script that automatically finds all .pack files and unpacks them in the right folders.