简体   繁体   中英

Embedded java at desktop application

If it possible to build java desktop application with embedded JVM? I do not need to depend on the end user having the right JRE installed.

I build my application for Windows with l4j maven plugin . Googling does not give needed results. Maybe you someone know how to do it with maven o gradle , not by some another utility like Avian, ProGuard and etc. ( Embed a JRE in a Windows executable? )

The Maven plugin for Launch4j lets you generate the Launch4j executable as part of the Maven build process. It supports Maven 2.0.4 and Launch4j 3.x.

See here

This is a sample of the configuration that you can try to use:

    <plugin>
    <groupId>com.akathist.maven.plugins.launch4j</groupId>
    <artifactId>launch4j-maven-plugin</artifactId>
    <executions>
                ...
        <configuration>
                    ...
            <jre>
                <!-- Specify path or minVersion or both. -->
                <path>bundled JRE path (%VAR%)</path>
                <bundledJre64Bit>true|false</bundledJre64Bit>
                <bundledJreAsFallback>true|false</bundledJreAsFallback>
                <minVersion>x.x.x[_xx]</minVersion>
                <maxVersion>x.x.x[_xx]</maxVersion>
                <jdkPreference>jreOnly|preferJre|preferJdk|jdkOnly</jdkPreference>
                <runtimeBits>64|64/32|32/64|32</runtimeBits>
                <!-- Heap sizes in MB and % of available memory. -->
                <initialHeapSize>MB</initialHeapSize>
                <initialHeapPercent>%</initialHeapPercent>
                <maxHeapSize>MB</maxHeapSize>
                <maxHeapPercent>%</maxHeapPercent>
                <opt>text (%VAR%)</opt>
            </jre>
                    ...
        </configuration>
    </execution>
</executions>
</plugin>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM