Skip to main content

Making a runnable jar of my project in Eclipse

Please note these forums are being decommissioned and use the new and improved forums at
1 reply [Last post]
Joined: 2013-07-22

I have a Java swing project which i need to test on other computers. I have some classes and a sqlite db which stores login information. I have some lib jars as well. The application takes information from the user and stores it in the sqlite db and then pushes data to the web. I want to package my project so that whoever uses my project has to just double click on an executable or jar. Here is my folder structure -

>default package
>rest package

The problem i face is that the jar is not able to read file.fcl. This is a fuzzy logic controller file that i use in my project. It runs fine in Eclipse. I make a Runnable jar file from Export->Java->Runnable Jar File. Then i try to run it from cmd java -jar This gives me an error -

Error reading file 'file.fcl'
Cant load file 'file.fcl'

How can i include the fcl file in the runnable jar, so that it can read it. I tried pushing it in the src folder as well. But it doesn't work. Maybe i am missing something really basic here. Please help me out.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2013-08-10

If my understanding is right, I think you calling file.fcl like this :
new File("file.fcl");
if so then you have put in the same folder with the jar ,but not in the jar itself
If you want to put in the jar then you will not be able to edit it and have to access it like this :
Please note that in packagepath you replace dots (.) with (/)
Hope it helps