当前位置:网站首页>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.
③然后点击确定即可,现在就添加成功了,可以调用包内的类了。
边栏推荐
- Common singleton functions traverse dictionary functions
- Data query of server SQL. The most important chapter in database learning
- InfiniBand& RDMA
- 银河证券靠谱吗?开证券账户安全吗?
- Legal mix of settlements (utf8mb4_0900_ai_ci, implicit) and (utf8mb4_general_ci, implicit) error resolution
- Openocd adds third-party device support: ht32f52352 Cortex-M0+
- [nailing scenario capability package] video conference (official conference system)
- How to write an infinite loop
- 01 network basics
- Writing manuals using markdown
猜你喜欢

C language dynamic memory allocation

Working principle and experimental analysis of DHCP

【hnu暑学期】数据库系统设计 准备阶段
![[important notice] developer document update (12.13-12.19)](/img/49/6a54235409ec95fa50bcc14ef1d405.jpg)
[important notice] developer document update (12.13-12.19)

Understand two major web development patterns

What is a server? (Powercert animated videos)

Canoe learning notes (3)

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

C language soul torture: do you know the difference between the two?

js(3)
随机推荐
Docker Alpine image installation PHP extension redis
OSI notes sorting
Canoe learning notes (1)
HNU计网实验:实验四 应用层和传输层协议分析(PacketTracer)
Zhiyun health is about to go public: long-term losses, meinian health Yu Rong has withdrawn, and it is difficult to be optimistic about the future
Basic knowledge of software engineering required for soft test
PHP runtime and memory consumption statistics code
Illustration tcp/ip - Chapter 1 and 2 Notes
HNU计网实验:实验一 应用协议与数据包分析实验(使用Wireshark)
org. apache. ibatis. exceptions. PersistenceException:
Win11开始菜单右键空白?Win11开始菜单右键没反应解决方法
Is it safe for Xiaobai to open a stock account online?
Sqlmap for interface security testing
Explain memcached principle in detail
Simulate ATM system (account opening, login, account query, withdrawal, deposit, transfer, password modification, account cancellation)
Measurement fitting based on Halcon learning -- Practice [2]
Website judges network connection disconnection, JS judges network connection disconnection, best practice
STM32 self balancing robot project, with code, circuit diagram and other data attached at the end (learning materials and learning group at the end)
MySQL operation Basics
Writing manuals using markdown