[newbie] jar exporting problem

I use Eclipse 3.1 with jme and I tried to export my app to jar file

but I always got the message “Could not find the main class. Program will exit”.



I do this



right click at my app: TestJar -> Export







next, next







Any advise would help 




Try using an Ant build file instead…it will make your life easier. :wink:



darkfrog

Thanks in advance, darkfrog

I'll try it out  :smiley:

I have the same problem. I use NetBeans, and export the jar by right-clicking my project and choosing "Build project". When I launch the jar-file by double-clicking it, the java Virtual Machine Launcher says:

Cinamon Rolls said:

"Could not find the main class. Program will exit".


This is the contents of my jar-file:

magar.jarmagarGameEngine.class
magar.jarMETA-INFMANIFEST.FM

The contents of magar.jarMETA-INFMANIFEST.FM:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.2
Created-By: 1.4.2_10-b02 (Sun Microsystems Inc.)
Main-Class: magar.GameEngine
X-COMMENT: Main-Class will be added automatically by build

I have no problem running it from NetBeans.

If you use Eclipse, try the "FatJar" plugin:



http://fjep.sourceforge.net/



It can make one single jar containing all classes (your own, jme, lwjgl, etc) with a few clicks, even if they're in seperate eclipse projects. You'll only need to include the dll, so, jnilib files. A cool trick is to extract those from the jar in the main() method. If they end up in the directory your jar was launched from, there's no need to do the whole -Djava.library.path stuff, and users can just doubleclick the jar to run it.



Hm, as long as we're talking about packeging, did anyone have any luck with RetroGuard or ProGuard and jME?