当前位置:网站首页>idea怎么把自己的项目打包成jar包
idea怎么把自己的项目打包成jar包
2022-06-25 21:32:00 【西里小诸葛】
idea怎么把自己的项目打包成jar包
一、思路
首先准备两个建立两个工程,一个工程作为提供jar包的工程,另一个工程作为调用jar包的工程。(注意在idea中工程文件是moudule,而不是project,project是工作空间)。
二、建立一个提供jar包的工程项目
1.首先建立一个moudule项目,并新建一个部门类(Dept.java).
2.打开Project Structure,进行如下操作:(快捷键ctrl+alt+shift+s)
①选择Artifacts,点击+号,新建一个空的jar包文件
②给jar文件命名(英文),并把你要打包成jar包的工程,拖到刚命名的jar包上。

③接着会出现以下结构,然后应用。
④由于刚才我们更改了Artifacts的设置,现在我们需要Build Artifacts。点击Buid-Buid Artifacts。 
接着选择我们要Buid的jar包。
⑤回到前面的Project Structure中找到导出的jar包的路径,然后在我们的电脑对应的路径下,就可以找到我们导出的jar包了。

三、创建一个工程调用jar包,使用jar包中的类文件。
1、工程的创建跟之前相似。在新建的工程下,我们新建一个TestMain类,用来测试能否调用前面导出jar包中的Dept类。具体步骤如下:
①复制secondjar.jar包,粘贴到调用jar包的工程下
②右击secondjar.jar,点击Add as Library.
③然后点击确定即可,现在就添加成功了,可以调用包内的类了。
边栏推荐
- How to solve the problem of flash write protection in STM32?
- On merging and sorting
- Legal mix of settlements (utf8mb4_0900_ai_ci, implicit) and (utf8mb4_general_ci, implicit) error resolution
- Insert picture in markdown
- How to write an infinite loop
- Basic knowledge of software engineering required for soft test
- Free cloud function proxy IP pool just released
- Canoe learning notes (1)
- Solve the parameter problem that laravels cannot receive wechat callback
- The difference between strcpy and memcpy
猜你喜欢
![[nailing - scenario capability package] nailer card](/img/ec/c2f342a54ab69d8b834a8a1c8f8a01.jpg)
[nailing - scenario capability package] nailer card

ASC - DAY2

STM32 self balancing robot project, with code, circuit diagram and other data attached at the end (learning materials and learning group at the end)

Windows11 windows security center cannot open Windows Defender cannot open

智云健康上市在即:长期亏损,美年健康俞熔已退出,未来难言乐观

OSI notes sorting

Big end and small end

QT method of exiting application (exe)

ASP. Net core uses function switches to control Route Access (Continued) yyds dry inventory

Soft test intermediate simple notes
随机推荐
05 configuring network parameters
Concept and understanding of variables
Bear market guide | some essential lessons and specific survival rules
IAAs, PAAS, SaaS, baas, FAAS differences
Kubernetes related knowledge - surprise interview
CANoe. Diva operation guide TP layer test
Command 'GCC' failed with exit status 1 when PIP install mysqlclient
Big end and small end
Set eye color
ZABBIX foundation details
Php7.4 arm environment compilation and installation error invalid 'ASM': invalid operate prefix '%c'
Circular structure and circular keywords
HNU数据库系统概论 ODBC
Jmeter- (II) basic interface and common components for interface testing
银河证券靠谱吗?开证券账户安全吗?
Win11录屏数据保存在哪里?Win11录屏数据保存的位置
24 pictures to clarify TCP at one time
Free your hands and automatically brush Tiktok
QT method of exiting application (exe)
UDP Vs TCP (Powercert animated videos)