Installing the JDK on a Windows machine without administrator privileges

In today’s post we see how to install the Java Development Kit (JDK) on a Windows machine without having administration permissions. Without these rights, in fact, you can’t install the jdk through the step-by-step wizard but it’s necessary to install it manually.
First, after downloading the correct version of the jdk for our operating system, we try to run the installation by double clicking the icon. In my case the operating system is Windows 7 64bit, so the version of the jdk is jdk-7u67-windows-x64. Trying to launch the installation we get the following error, which indicates that we don’t have sufficient privileges to install it and we must log in as administrator.



But we can’t log in as administrators, so we have to find an alternative solution.
We open the jdk installation file, jdk-7u67-windows-x64.exe , with 7zip and look at its contents. As we can see in the figure below, the content is a zip file called


Entering further within this zip file to see its contents we get what shown in the figure:

At this point we extract all the contents into a folder on the file system in our user area, for example: C:\Users\MolinariD\jdk-7u67.
Browsing through the contents extracted from the zip and copied to the folder, we will find some files with extension .pack, precisely under the folders lib and jre/lib.
The following figure shows the contents of the folder /jre/lib where we can see some of these .pack files.


These files are nothing more than good old .jar files further compressed with a tool called pack200 supplied directly with the jdk. What we have to do is to unpack these .pack files to their relevant .jar files using the “inverse” command, unpack200. For further details, see the official documentation of pack200 and unpack200 commands.

Now we go into the /lib directory of the JDK and execute a dir command to get the list of available .pack files. We see that there is a file called “tools.pack”, so we execute the following command: unpack200 tools.pack tools.jar.


The same operation performed on the file tools.pack needs to be executed for all the .pack files present in the jre/lib folder. To do this, however, we don’t want to repeat manually the unpack command for each of them, but instead we write a DOS script that will do it for us (as in my case JDK needs to be installed in this way on several machines).

What our script will do is:
1) require to the user the path of the folder containing the jdk
2) search for all .pack files present in subdirectories
3) run the unpack200 command on all these files

For point 1) we use the SET command with the /P option that allows us to get a value inserted as input by the user, showing him a prompt message.

For point 2) we use the FORFILES command that allows us to select a group of files and execute a specific command on them. FORFILES offers the following options we’re going to use:
/P specifies the path from which to start the search
/S indicates to search recursively also on subdirectories
/M allows you to define a search filter in order to filter the files according to a particular pattern
/C is the command to execute on the files, which must be enclosed in double quotes ”

For point 3) we simply invoke the command unpack200 providing as parameters the name of the .pack file and its equivalent with the replacement of the extension in .jar that we can get with a replace instruction (outputName=%outputName:pack=jar%)

Here’s our script:

echo off
REM Author: Molinari Davis -
REM Version: 0.1
REM Date: 29/08/2014

if "%1"=="/processFile" goto processFile
SET /P commandPath=Insert the jdk folder path: 
SET commandName=\jre\bin\unpack200.exe
FORFILES /p %commandPath% /s /m *.pack /c "cmd /c call "%~f0" /processFile @path"
goto :EOF
SET outputName=%2
SET outputName=%outputName:pack=jar%
SET fullCommand=%commandPath%%commandName% %2 %outputName%
REM echo %fullCommand%
	echo ERROR in extraction of file: %outputName%
) else (
	echo Extracted file: %outputName%

Now that we have created the script we just have to run it. Once launched, as expected, we are asked to indicate the path where the folder is located in the jdk:


In this case I had unzipped the folder to the path C:\Users\MolinariD\jdk-7u67 so now I enter this path as input of the script:


At this point, the script searchs for of all the .pack files present in subfolders and extracts for each of them the corresponding .jar file.
The result of the execution of the script is shown in the following figure:


As a last step we verify the presence of the .jar file that we expect. Looking for example in the jre/lib folder we see that, for each .pack file there is its corresponding .jar file.


So our script worked and we have a jdk installed and ready to use.

The script created is available for download here:

18 thoughts on “Installing the JDK on a Windows machine without administrator privileges

    • Good!
      Thank you very much for your feedback! (the script has been downloaded 75 times so far and you’re the first one who gives me a feedback comment :) )

      • Hi, nice work but I cant use the script:

        I need to do the tasks with jdk5 (yes, I’m sad dealing with this :( ), jdk6, jdk7 and jdk8, but only jdk7 is correctly unzipped,¿how extract the other jdk’s?

        • Hi,
          in a previous comment Wilhelm explains how to adapt the script for the JDK 1.8
          I’m sorry, I don’t know how older jdk versions are packed and if the script can be modified in order to use it with those.

  1. This assumes you have access to command prompt. CMD is blocked by the administrator on this computer. Is there any way around this ?

  2. I need help entering that command when I enter it is says “unpack200” is not recognized as an internal or external command, HELP PLEASE

  3. Thanks for the great tutorial. This all worked well, but the application I’m trying to run always refers to the pre-installed JREs on c:\, which I can’t delete or overwrite without admin rights. How can I run the application and the JDK from a USB stick, without the application referring to the installed old Java files? Thanks!

  4. Still works fine for jdk1.8.0.102
    Look for file 111 in a directory …CAB10, it is an archive without extension containing
    So, Java inside is three times packed in the jdk installation exe.And the library files in the pack archives are alreeady fout times packed.
    Just to make things more complicated.

    • Thank you for your feedback and for sharing with us these information about how to use my script with jdk 1.8


Leave a Reply

Your email address will not be published. Required fields are marked *