Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running a Java application on a machine that doesn't have a JVM

Tags:

java

jvm

I have created an .exe file of my software (which is a Java swing application). But the .exe file is running only on those computers which have the JVM installed. I want to run it on computers which do not have the JVM installed. How do I accomplish this?

like image 989
desprado Avatar asked Apr 04 '11 18:04

desprado


3 Answers

You need a JVM to run Java. There's no getting around that.

Users that don't have a JRE installed will have to get one. Don't confuse that with the JDK. They don't need all the development tools, just the runtime engine.

like image 127
duffymo Avatar answered Nov 09 '22 14:11

duffymo


You'll need to ship JVM with your application one way or another anyway. So why not include JRE into the installation bundle?

Another option would be creating an installer that will download JRE automatically from the Internet if it isn't installed. For example you might want to check out this guide http://nsis.sourceforge.net/Java_Launcher_with_automatic_JRE_installation (but read about NSIS first if you're unfamiliar with it).

like image 5
bvk256 Avatar answered Nov 09 '22 15:11

bvk256


I don't know what application you used for wrapping the jar as an exe but I recommend you to use Launch4j which is a wrapper who can check if the user has already installed JRE/JDK before trying to execute the application and if it doesn't it will display a message and open the browser to download java.

like image 2
Alfredo Osorio Avatar answered Nov 09 '22 14:11

Alfredo Osorio