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

How to package Java Program with IDEA Software

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

Share

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

This article mainly introduces "how to package Java programs with IDEA software". In daily operation, I believe many people have doubts about how to package Java programs with IDEA software. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "how to package Java programs with IDEA software". Next, please follow the editor to study!

Preface

Before we talk about these two ways, let's explain what the jar file in java is.

Jar (Java Archive File), translated is the java archive file, in fact, it is also similar to our windows zip file, the only difference is that in the content of the JAR file, contains a META-INF/MANIFEST.MF file, this file is automatically created when the JAR file is generated, contains the description of the JAR package, the full class name of the main class and other information.

One: do not use Maven to directly hit the Jar package.

1.File-- > Project Structure-- > Artifacts-- > Jar-- > From module with dependencies.

After clicking ok, we found in the previous step Project Structuer that our jar package output directory has been filled in by default in IDEA. At this time, we can change the above jar package output directory, which is more convenient to manage. At this time, we can change the number path and click Apply in the lower right corner.

2.Build-- > Build Artifacts

After selecting the Build Artifacts above, the following Build pops up automatically

3. At this time, we went to the corresponding jar package output directory and found that there was already a corresponding package.

4. Running

You can run the jar package in two ways

Java-classpath xxx.jar xxx.xx.xx. Main class name java-jar xxx.jar II: use Maven to pack jar packages

1. When you use Maven in your Project, you can directly perform packaging in Lifecycle, the first step in compilation do not forget, before I always run jar package error is because there is no compile directly package.

two。 After double-clicking package, we can find that a corresponding jar package is generated in the target directory, where the jar package is actually the same as method one, except that we use Maven to generate it this time.

At this point, the study on "how to package Java programs with IDEA software" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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