Can we run a Java application on a system without a JRE?

I created a java application. I created Excecutable jar and Exe files for my application. But it cannot be started on a system in which a computer is not installed. How to do it? Can I customize the JRE in an EXEcutable jar or Exe file? Any idea?

+4
source share
6 answers

I think this project: launch4j may be useful to you. It can wrap the jar in an executable file and combine the JRE to make it behave like its own application.

+9
source

JSmooth is an executable Java wrapper . It creates its own Windows launchers (standard .exe) for your java applications. This makes Java deployment smoother and more user friendly, as it can locate any Java VM installed on its own.

If there is no virtual machine, the shell can automatically download and install the appropriate JVM, or simply display a message or redirect the user to the website.

+4
source

You cannot pack the JRE inside the Jar, but you can pack it with your jarfile and install the installer for installation. Sun / Oracle allows you to redistribute JREs only for this purpose (systems that do not have them).

+2
source

Yes, you can create OS-specific executables from java applications, a question has already been asked about this topic, for example here: Insert a JRE into a Windows executable?

Java is always compiled into OS-independent byte code that can only be executed on a Java virtual machine, such as the one that comes with the JRE.


Just because you marked your question β€œeclipse” and mentioned the file β€œexe” ... just in case you created the RCP eclipse application, then there is an elegant way to associate the application with the Java runtime: Just create a folder called "jre" inside your application directory (at the same level as the plugin and the function folder) and copy the JRE to this folder. On eclipse export pages, a checkbox can be checked to associate the application with the JRE.

+1
source

Yes, this is a subset of another question that I answered here . Either a Java-enabled installer that will package the JRE and include it, or compile it in "native" ( JET , GCJ, or IKVM ). I used the latest non-GUI application and it works pretty well.

+1
source

You can try to compile it in binary format using CGJ . You will need to install Cygwin or MinGW on the host machine with which you want to associate your application, but this is a clear solution, because it compiles the entire program into its own code.

Look here ..

0
source

Source: https://habr.com/ru/post/1312432/


All Articles