How do I run a JAR file without installing Java?

My question may seem odd but this is indeed what I need to do. For the first in the last (maybe) 10 years I have to run a JAR file in my computer. But I don't want to install 'the Java' (and all those things it adds into your system). How can I run that JAR file?


You have two options


  1. Use jPortable together with jPortable Launcher

    jPortable Launcher allows you to easily run Java JARs from your PortableApps.com-enabled device with the jPortable portable Java Runtime Environment installed.

    To use this, visit PortableApps.com and search for jPortable . A list of result should come up and then select the runtime environment and the launcher (links above). Then download both of them, and install per directions. A folder will be created where the downloaded files were run from. Inside one of them will be "JavaPortableLauncher.exe". If you launch it, you should be able to locate and open a jar file with the application.

    The Launcher

(or)

  1. Download and extract the Windows x86 tar.gz version and start your .JAR file from commmand line: start C:\Java\bin\javaw.exe -jar C:\myfolder\myprogram.jar

I remember that severel years ago you could download Java, unzip it, put it somewhere in a folder, and by pointing to the java executable in that folder you could run java. I don't know how it works today with the current versions, but I wouldn't be surprised if it still could work like that. Don't have Windows here, so can't test it, but you can download a zip (or tar.gz) file, unzip that and than work from there. If you can't unzip gz files, download and install 7-zip.

This won't install it like you normally do, so no update alerts etc, no browser integration, no system variables, but you need something to run that code, and this is the least I think.

http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html

Download one of the tar.gz versions.


This just worked for me:

  1. download the Java installer for whatever version you want;
  2. open it with 7-zip;
  3. locate and extract the tools.zip file (it can be in different directories, depending on Java version, build, or if it is a JDK or JRE);
  4. expand tools.zip in some ;
  5. go into and run for /r %x in (*.pack) do .\bin\unpack200 -r "%x" "%~dx%~px%~nx.jar;
  6. try running bin/java -version.

If it works, thats it, you have got yourself a portable JAVA_HOME.