1 Introduction
Sometimes we encounter a jar package that contains multiple class files in a project. Here is how IDEA creates a jar package (non-module).
2. Problem solving
2.1. Step one: Select Project Structure in the upper right corner
Method one:
![![](https://img-blog.csdnimg.cn/c93a89b6e47849d9a86ccd0555f9f6cf.png](https://img-blog.csdnimg.cn/82282d9a11ac436c968b2e217b37546d.png)
Method two:
![Insert image description here](https://img-blog.csdnimg.cn/e62e8d4f19fb48028282ddd2a0f651c8.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA54iq5ZOHeGlhb-eZvQ==,size_12,color_FFFFFF,t_70,g_se,x_16)
2.2. The second step
![Insert image description here](https://img-blog.csdnimg.cn/8078dad011b24fbea0d152ecb37ca9ce.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA54iq5ZOHeGlhb-eZvQ==,size_20,color_FFFFFF,t_70,g_se,x_16)
2.3. Create a new empty jar. The default name is unnamed. You can change the name of the jar package according to your own needs.
![Insert image description here](https://img-blog.csdnimg.cn/bd98148e25db4823a39843f33249131e.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA54iq5ZOHeGlhb-eZvQ==,size_20,color_FFFFFF,t_70,g_se,x_16)
2.4. Click New Directory in the upper left corner to create a new directory, and then create a new directory.
![Insert image description here](https://img-blog.csdnimg.cn/fcb09f561cc24359ae966fdcc6d01af0.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA54iq5ZOHeGlhb-eZvQ==,size_15,color_FFFFFF,t_70,g_se,x_16)
2.5. The newly created directory structure must be consistent with the directory structure of the project.
![Insert image description here](https://img-blog.csdnimg.cn/79789145b12a4e829039f4a188762753.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA54iq5ZOHeGlhb-eZvQ==,size_20,color_FFFFFF,t_70,g_se,x_16)
2.6. Select “+”–>File
![Insert image description here](https://img-blog.csdnimg.cn/571f3c36aa9e4515a58153a87eba1ae2.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA54iq5ZOHeGlhb-eZvQ==,size_12,color_FFFFFF,t_70,g_se,x_16)
2.7. Note that the selected file is a compiled .class file. Select one or more as needed. After adding the file, select "Apply"->"OK"
![Insert image description here](https://img-blog.csdnimg.cn/2e41a94bd1394b998c1b169ee41d5b18.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA54iq5ZOHeGlhb-eZvQ==,size_13,color_FFFFFF,t_70,g_se,x_16)
2.8. Select Build–>Build Artifacts… in the upper left corner
![Insert image description here](https://img-blog.csdnimg.cn/811c049bb60f4322a722aea258c7c8e8.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA54iq5ZOHeGlhb-eZvQ==,size_11,color_FFFFFF,t_70,g_se,x_16)
2.9. Select the newly created jar, Build/Rebuild is available.
![Insert image description here](https://img-blog.csdnimg.cn/64d15f78795942b8984da32aeec28379.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA54iq5ZOHeGlhb-eZvQ==,size_10,color_FFFFFF,t_70,g_se,x_16)
2.10. Find the jar you just typed in the file.
![Insert image description here](https://img-blog.csdnimg.cn/d89e9e3921dd47d6a126e0fb6c870019.png)
2.11 If you can't find it, you can create a new jar. There is an Output directory, which is the file directory where the jar is located.
![Insert image description here](https://img-blog.csdnimg.cn/ca41fb71a1db4cf39daf0fb4a37209e4.png)