I have made a Java Swing application and now I want to export it as an executable jar
file. I have created the app in Eclipse
, and it has the following structure :
where folder mysqlconnector
contains also a jar
file. So first I tried following the instructions in this link and created seo.jar
, but when I try to execute it from the terminal by java -jar seo.jar
I get an error :
Error: Could not find file connectionprops.properties
As the screenshot shows, I tried putting connectionprops.properties
in main
package, but the same problem remains.
Then I tried making a manifest
file named manifest.mf
with contents :
Main-Class: bin.main.MainClass //also tried Main-Class: MainClass
as the structure of my project is :
seo --> bin --> main --> MainClass.class
I placed the manifest.mf
in folder seo
and I gave the following command in the terminal :
jar -cvfm seo.jar manifest.mf *
but again when executing it from the terminal by java -jar seo.jar
I get an error :
Error: Could not find or load main class bin.main.MainClass
What am I doing wrong? Should I change something in my project structure? Is there a problem that I have other jar
files inside my project? How can I create the executable jar
and execute it successfully?