Launch4j jar变exe 使用记录

目录

Launch4j介绍

方式一:Windows exe安装包方式

下载 

使用

基本设置

Header设置

JRE设置

版本信息

保存配置

运行

方式二:Maven插件集成 【推荐方式】

pom.xml


Launch4j介绍

用于创建轻量级Windows本机exe的跨平台Java可执行包装器。提供高级JRE搜索、应用程序启动配置和更好的用户体验。

Cross-platform Java executable wrapper for creating lightweight Windows native EXEs. Provides advanced JRE search, application startup configuration and better user experience.

方式一:Windows exe安装包方式

下载 

         地址 :Launch4j Executable Wrapper download | SourceForge.net

使用

        安装后启动

基本设置

Header设置

    Gui 是图像窗口 Consol 是命令窗口

JRE设置

版本信息

保存配置

相关信息设置完成后点击保存相关设置到xml 就会执行打包exe , 相关日志输出Log

运行

运行

方式二:Maven插件集成 【推荐方式】

截至目前最新版本

pom.xml

官方baseDemo :launch4j-demo/pom.xml at master · orphan-oss/launch4j-demo · GitHub

<plugins>
            <plugin>
                <groupId>com.akathist.maven.plugins.launch4j</groupId>
                <artifactId>launch4j-maven-plugin</artifactId>
                <version>2.2.0-SNAPSHOT</version>
                <executions>
                    <execution>
                        <id>l4j-gui</id>
                        <phase>package</phase>
                        <goals>
                            <goal>launch4j</goal>
                        </goals>
                        <configuration>
                            <!-- header 类型 -->
                            <headerType>gui</headerType> 
<!-- jar位置 -->                                    
<jar>${project.build.directory}/${project.artifactId}-${project.version}.jar</jar>
                            <!-- exe输出位置 -->
                            <outfile>${project.build.directory}/app.exe</outfile>
                            <downloadUrl>http://java.com/download</downloadUrl>
                            <!-- 自定义classPath 没有可忽略 -->
                            <classPath>
                                <mainClass>software.orphan.launch4j.App</mainClass>
                                <preCp>anything</preCp>
                            </classPath>
                            <!-- jre配置 -->
                            <jre>
                                <path>%JAVA_HOME%;%PATH%</path> <!-- jre -->
                                <minVersion>1.8</minVersion>  <!-- 版本 -->
                                <bundledJreAsFallback>true</bundledJreAsFallback>
                                <jdkPreference>preferJre</jdkPreference>
                                <requiresJdk>true</requiresJdk>
                                <bundledJre64Bit>true</bundledJre64Bit>
                                <runtimeBits>32</runtimeBits>
                                <!-- vm参数 -->
                                <opts>
                                    <opt>-Dname=Lukasz</opt>
                                </opts>
                            </jre>
                            <messages>
                                <bundledJreErr>Test bundledJreErr</bundledJreErr>
                            </messages>
                            <!-- 版本信息 -->
                            <versionInfo>
                                <fileVersion>1.0.0.0</fileVersion>
                                <txtFileVersion>${project.version}</txtFileVersion>
                                <fileDescription>Launch4j Demo App</fileDescription>
                                <copyright>Lukasz Lenart</copyright>
                                <productVersion>1.0.0.0</productVersion>
                                <txtProductVersion>1.0.0.0</txtProductVersion>
                                <productName>App</productName>
                                <companyName>Lukasz Lenart</companyName>
                                <internalName>app</internalName>
                                <originalFilename>app.exe</originalFilename>
                                <trademarks>Luk ™</trademarks>
                            </versionInfo>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值