Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the steps for packaging Java jar into an exe application

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article is to share with you about the steps of packaging Java jar into exe applications, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

Preface

Recently did a front-end merger of the spring boot project, but the requirements to achieve the exe file, provided to do not understand the computer Xiaobai installation, to study for a long time, remember that Java jar packaged into exe applications, can be run in a JDK/JRE-free environment.

Prepare for

Preparatory work:

A jar package, no jar package that bug can start normally

Exe4j, a tool for converting jar to exe, link: https://www.yisu.com/softs/541579.html

A tool that combines dependencies with exe into an installer, link: https://www.yisu.com/softs/20434.html

Start

Take me as an example, I put the jar package on the desktop

Open the installed exe4j

Go directly to the interface and select JAVA to EXE.

Then click next, enter the name and output path

Continue to click next and select startup mode

There is an option below to set the packaged program to be compatible with 32-bit and 64-bit systems.

Check when you come in.

And then continue to the next step, always appear the following interface, start to select the jar package and configure

Add:-Dfile.encoding=utf-8 where the VM parameter is configured

Click next to configure JRE

Click on the drop-down box to enter the following interface

The purpose of writing in this way is to eventually package the local jre directory with exe, and let the exe file find the packaged jre according to the path, but you no longer have to install jdk.

Next, select Client VM

And then go all the way to the next step, and finally the following interface appears

At this time, you will find that there is an extra demo.exe file on the desktop. At this time, don't rush to open it. The next step is to package and merge the jre and exe files, so that you can run without jdk.

Open inno setup, upper left corner File-New

Click the next step directly, fill in the configuration, application name, version, etc., and feel free

Then click on the next step. This place defaults to the next step.

Then select the generated exe file

Then next, enter this interface to keep the default, and go straight to the next step.

Still the next step, never mind.

To move on to the next step, here is to choose the language.

Then choose the output path and fill in the name of the installer.

Then the next step is to click Next directly, and then end it.

When you get to the last step of the configuration, the script file will pop up and ask you if you want to compile right away, choose no, write the script first and then compile it yourself.

Then to the final step, write the local JRE into the script

Source: "own local JRE path\ *"; DestDir: "{app}\ {# MyJreName}"; Flags: ignoreversion recursesubdirs createallsubdirs

Then just compile directly. You will be prompted to save the current script, give it a random name, and you can continue to use the next one.

Then wait for the green scroll bar to finish.

When the green scroll bar ends, there will be an extra setup.exe file on the desktop

At the same time, it will jump out of an installation, because the program will help you start the generated installer automatically, and you can install it. Remember to check create a shortcut when installing.

This is the last program, double-click to run can see the results, the setup.exe file to others to install, you can see their own program

What are the characteristics of Java? what are the characteristics of Java? what is the 1.Java language that represents the static object-oriented programming language? it implements the object-oriented theory and allows programmers to carry out complex programming in an elegant way of thinking. 2.Java has the characteristics of simplicity, object-oriented, distributed, security, platform independence and portability, dynamic and so on. 3. Using Java, you can write desktop applications, Web applications, distributed systems, embedded system applications, and so on.

These are the steps of packaging Java jar into exe applications, and the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report