The jar file exported by IDEA does not display pictures

problem:

After using idea to export the Java project to the jar package, because there are pictures used, the pictures cannot be displayed.
What I think is how to package the image and code into a jar file.

Then I realized that it wasn't the pictures that were packaged in. Instead, create a new folder that is the same as the project and put the pictures used

I feel that the generated jar file is equivalent to the src level

Take my project as an example:

My project is to create an images folder at the same level as src, and the pictures are in it. The generated jar file does not display pictures after opening.
When I create an images folder next to the jar file (as shown below), I put pictures in it. Run the jar again to display the picture.
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_42524288/article/details/103828249