Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include resource folder in executable .jar file in eclipse?

I need to create an application for sorting various types of polygons using various parameters such as height, volume or base area. Arguments for Filename which has parameters for polygons, Sort type, Sort method will be pass through command line.That file is in my resource folder outside my src folder in a project. I have implemented all programs, It works fine when I run using pass arguments through eclipse run configuration. But when I try to run my .jar file using cmd same arguments it gives me FileNotFoundException.

I opened my jar file using 7zip and noticed it never extracted my resource folder in .jar file. I searched online and tried including my resource folder in to build path of eclipse. But still does't work.

enter image description here

like image 563
S.P Avatar asked Aug 31 '25 17:08

S.P


1 Answers

Follow these steps:

1) click project -> properties -> Build Path -> Source -> Add Folder and select resources folder.

2) create your JAR!

EDIT: you can make sure your JAR contains folder by inspecting it using 7zip.

Reefer this link as well How do I add a resources folder to my Java project in Eclipse

like image 96
arjunsv3691 Avatar answered Sep 02 '25 07:09

arjunsv3691