Home > Java > javaTutorial > body text

How to Bundle a JRE with Launch4j and Where to Find a Portable JRE?

Susan Sarandon
Release: 2024-11-19 22:13:02
Original
430 people have browsed it

How to Bundle a JRE with Launch4j and Where to Find a Portable JRE?

Bundling a JRE with Launch4j

Question:

How can I integrate a JRE into a bundled EXE using Launch4j? Additionally, where can I find a portable and compact JRE for execution?

Answer:

To successfully bundle a JRE within your application's EXE file using Launch4j, follow these steps:

  1. Package your application: Create a zip file containing the following folders:

    • containerFolder
    • jre (containing bin and lib folders with java.exe)
    • cfg (optional, for user configuration)
    • bin (containing your application's EXE, JAR, and other components)
  2. Configure Launch4j's XML file: Specify the JRE's location using the following syntax:

    <jre>
        <path>../jre</path>
        <opt>-DgvSIG.confDir=../cfg</opt>
    </jre>
    Copy after login

Key Point:

The path provided in the XML file is not to the java.exe file itself, but rather to the parent folder of java.exe. This allows Launch4j to properly locate and access the JRE during application execution.

Note:

The JRE used in this solution is obtained by extracting the JRE folder from an existing Windows installation. This ensures you have a JRE that is both portable and compatible with your application.

The above is the detailed content of How to Bundle a JRE with Launch4j and Where to Find a Portable JRE?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template