Creating a dist package

Hello everybody…  :smiley:



I want to know what I have to do to my .jar dist package needs to run! I am using NetBeans to create my JME game, but when I "clean and build" my project, and try to execute the .jar that netbeans created I have the following JOptionPane error:

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

But I already defined a main class o projects properties???



Is there any more else configuration???  :?  :?

Please, help…  :expressionless:



Thanks…



Guilherme  :wink:

Please take a look at the netbeans tutorial:



http://www.jmonkeyengine.com/wiki/doku.php?id=setting_up_netbeans_5.0_to_build_jme_and_jme-physics_2



I hope it will help you.


  • justin

I already read this topic, but, what I want to know is when I create a .jar ready for distribution, but when I try to "clean and buil my project", and when I try to run just doing java -jar myproject.jar is when the error occurs…



To create a project is ok, but to create a .jar ready to dist is my problem…

GuilhermeFranchi said:

I already read this topic, but, what I want to know is when I create a .jar ready for distribution, but when I try to "clean and buil my project", and when I try to run just doing java -jar myproject.jar is when the error occurs....

To create a project is ok, but to create a .jar ready to dist is my problem...


Sorry, i had missread your first post and sorry again, i can't help you there.

- justin

Hm i get this too ??? The process seems ok - The jar is there and classpath and MainClass description in, but the lib directory containing the jme.jar … and the native libs is missing ??? could be project setup ?

does anybody know how to resolve my problem???  :’(  :?

Not with netbeans…

but I'm sure there's got to be a tutorial for creating a JAR inside netbeans on some netbeans related site.

As for the jme jars and dlls, just copy these manually. Then put the jars on the classpath with -cp and specify use -Djava.library.path for the dll(s) when you run your program.



However, "Could not find the main class. Project will exit" seems to suggest the class from your own program is missing, not anything jme related.



Personally I use FatJar to create on big jar, that puts all the classes (jme, lwjgl, my own program) in one single jar, and then put the dlls/so/jnilib in the same directory. However, it's an Eclipse plugin.



It's based on One Jar, which also works from the commandline: http://one-jar.sourceforge.net/

man, finally I got it…  :D  :smiley:

here's the point:

when I click "clean and build project" in my netbeans, the project was created ok in a .jar, but something is missing… the classes of jme… But, how i got jme from cvs, it not created a specific .jar containing the jme engine, just a "build path"… then i just added all subdirectories in the build directory ( "com.jme.*" ) to my project like packages… then when I run "clean and build project" and double click in the .jar created on dist directory in my project folder, the game just run…  :D  :D  :smiley:



but something new just appeared…  ://  ://

the .jme objects that contains textures, not loaded the textures, but the textures still there on the .jar file…



does someone knows what happening now???


GuilhermeFranchi said:

man, finally I got it....  :D  :D
here's the point:
when I click "clean and build project" in my netbeans, the project was created ok in a .jar, but something is missing... the classes of jme... But, how i got jme from cvs, it not created a specific .jar containing the jme engine, just a "build path"... then i just added all subdirectories in the build directory ( "com.jme.*" ) to my project like packages... then when I run "clean and build project" and double click in the .jar created on dist directory in my project folder, the game just run...  :D  :D  :D

but something new just appeared...  ://  ://
the .jme objects that contains textures, not loaded the textures, but the textures still there on the .jar file....

does someone knows what happening now???




Ya same

http://www.jmonkeyengine.com/jmeforum/index.php?topic=3869.0

problem solved…



the dist package was not importing the jme model texture because, on the .jme file the texture file was specified as an upper case file, and it was as lower case on my folder, then I renamed it as upper case and, "voal


Having simmilar problem here, therefore I am not opening new thread:

I also tryed to build jar distribution with NetBeans with no much success. Result jar file in first looked like this:
<Meta-inf>
Game.class

Auto generated Manifest.mf file looked like this:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.5
Created-By: 1.5.0_04-b05 (Sun Microsystems Inc.)
Main-Class: Game
Class-Path: lib/build lib/src lib/jinput.jar lib/jogg-0.0.5.jar lib/jo
rbis-0.0.12.jar lib/lwjgl.jar lib/lwjgl_fmod3.jar
X-COMMENT: Main-Class will be added automatically by build

I put manualy com.jme folder into my jar and that solved problem for jme classes, also puted lib folder with all lwjgl jars, dlls and other files from cvs. My distribution now look like this:
<com>
<lib>
<Meta-inf>
Game.class

Problem is that I still having error note about not having LWJGL. Guess that Manifest.mf file needs to be altered? Can someone tell me exactly how my manifest must look?  I tryed to put line -Djava.library.path=lib but didnt worked.  :?

I don't think you can have "-Djava.library.path=lib"  in your manifest file. You have to specify that when starting the VM, afaik. So, start your application this way:

java -cp [all:your:jME:and:self:created:jars] -Djava.library.path=lib [your.main.gameclass]

BTW, is there a place, wiki, User Guide, or anywhere, where using native libraries with java is explained? You sure should be able to handle your classpath when starting your first jME projects, but even a java developer with some experience might not have used external native libs before, and would welcome a little link collection or something regarding this topic. Maybe even the words "java and native libraries" are enough to get a somewhat useful list of google hits…

If I understand You right, there is no way I can make jME aplication (or any other aplication using native libs) which will be only one jar, capable to start with one click on Win, Mac or Unix platform?  :expressionless:



I dont like this, but I can live with it.

You can, but you have to extract the .dll/.so/.jnilib to the same directory as the jar before you initialize jME.



dll etc. can not be loaded from inside a jar. The loading is done by the operating system (which doesn't look inside a jar) not Java.



When you create a file with Java, you can also let the VM make sure it gets destroyed when your program exits (not sure if this will work if the dll is currently loaded, but worth a try perhaps).