How do I run a JAR file without installing Java?

22

4

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?

Ultralisk

Posted 2014-04-23T15:05:10.037

Reputation: 1 749

"install" java is nothing more than putting a java executable and some other basic jars somewhere on your filesystem, you might end up using just another JVM environment to load your own JARs. – Sajuuk – 2019-05-06T03:15:53.227

1>

  • Too broad. Differs for each application. 2. That's asking for a recommendation, which is off-topic.
  • < – gparyani – 2014-04-23T15:07:57.497

    You can manually uncheck the box every time you install or update. Alternatively, you can disable it using the registry.

    – gparyani – 2014-04-23T15:10:52.527

    This depends on each individual application. – gparyani – 2014-04-23T15:11:32.793

    2We don't solve questions by putting "solved" in the title. You should wait for @nixda to post his answer. – slhck – 2014-04-23T16:08:23.003

    2

    Even if your question was actually an XY problem: the above is not a duplicate of the one you voted for. What are you trying to achieve with your edits of the title and that close vote? Given your reputation on SO I guess you know, but please remember that all Stack Exchange sites try to be a useful resource for future visitors.

    – Arjan – 2014-04-23T21:20:23.910

    (Even more, I think it's a good question, which just makes me more curious...) – Arjan – 2014-04-23T21:24:59.613

    Answers

    19

    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

    nixda

    Posted 2014-04-23T15:05:10.037

    Reputation: 23 233

    Just wanted to add the comment that option two works now (edit from 2016)/Oracle offers directly the tar.gz file. I almost dismissed that second option after reading the comments from 2014. – Eleasar – 2017-05-16T10:30:49.903

    I have the Java runtime (jPortable) installed on my device/PortableApps/CommonFiles/Java. Where should I install the JPortable launcher? Same folder? – franz1 – 2020-01-18T14:13:46.073

    12 is not ok because it implies to install (now or in the past) Java on the 'another PC'. But 1 works. – Ultralisk – 2014-04-24T09:22:46.287

    2If you are concerned or have no access to a second machine, you could always install Java in a VM, backup the Java folder and uninstall Java again. I'm using the secondf approach for almost every Java program I'd like to run – nixda – 2014-04-24T10:00:18.207

    6

    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.

    SPRBRN

    Posted 2014-04-23T15:05:10.037

    Reputation: 5 185

    1+1 Didn't know they offer a tar.gz packet – nixda – 2015-02-02T18:42:54.280

    0

    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.

    lpacheco

    Posted 2014-04-23T15:05:10.037

    Reputation: 645

    which "Java Installer" are you talking about? – Sajuuk – 2019-05-06T12:55:42.507

    @sajuuk, I meant the .exe you download from Oracle. – lpacheco – 2019-06-05T10:23:47.037

    -1

    The best way is that convert your .jar file into .exe . follow this : JAR2EXE

    Emoji

    Posted 2014-04-23T15:05:10.037

    Reputation: 15

    2This looks like it requires Java. – slhck – 2014-04-23T16:09:45.890

    1

    Indeed this needs Java installed. See the system requirements at the right side

    – nixda – 2014-04-23T21:44:51.877