简体   繁体   中英

Eclipse referencing folders inside a Jar file

In my Java project I have a folder like the one below, where I put inside some icons that I'm going to use with JTree library.

在此处输入图片说明

When I run the Jar outside Eclipse, I cannot see my icons. If I open my Jar with archive utility, I cannot see the folder inside it. I also tried to add different folders and they are never referenced inside the final Jar. So, is there a way to reference the folders in the Jar file?

You need to ensure that Eclipse knows that while building the Jar it has to include the newFolder inside the Jar. You can do that in Eclipse by following the below step in :

  • click project -> properties -> Build Path -> Source -> Add Folder and select the new folder you just created.

Now create you Jar and you will see your folder in the Jar.

将文件夹(myFolder)移到src目录中,或将其标记为源文件夹。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM