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 use jar package in idea

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

Idea in how to play jar package, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

Mode one

Use the packaging method that comes with idea

Click File-> project structure

Select Artifacts and click the green plus sign

Click once according to the figure

This interface will pop up when you are finished, and it is very important to fill in the information at this time, otherwise it will not run.

1 and 2 can use the default 1 so that the typed jar package path information will not be typed into the MANIFEST.MF file. Select 2 will be typed into the file.

3 must modify the specific reason is not clear I am stuck here need to be modified to src/ or src/main

Then save and click Build-> Build Artifacts

Then there will be an out directory in the project to export the jar package.

Mode two

Use maven plugins to package

Add the following configuration to the pom.xml file

Org.apache.maven.plugins

Maven-compiler-plugin

2.3.2

1.8

1.8

UTF-8

${java.home} / lib/rt.jar

Org.apache.maven.plugins

Maven-dependency-plugin

${project.build.directory} / lib

False

False

Copy-dependencies

Package

Copy-dependencies

${project.build.directory} / lib

False

False

Org.apache.maven.plugins

Maven-resources-plugin

2.6

Copy-resources

Package

Copy-resources

UTF-8

${project.build.directory} / conf

Resource

True

* .bat

Copy-command

Package

Copy-resources

UTF-8

${project.build.directory}

Src/main/resources/

True

* .bat

Org.apache.maven.plugins

Maven-jar-plugin

2.4

True

Lib/

Test.data.com.pythonMain.PMain

Conf/

* * / .class

At this point, there will be jar files and lib and conf folders in the target directory. You need to Copy these packages together and then java-jar XX.jar will be fine.

Mvn clean package-Ptest-Dmaven.test.skip=true maven packaging command

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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

Internet Technology

Wechat

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

12
Report