One stupid question
I have coded something in eclipse version 3.4 under jme3
I run the code its fine , everything is good but i want to publish it as a jar file that i can show the result to someone
How could i publish my code as a single jar file?
Import the project to jMP and click clean&build
A quick (but dirty) way would be to create an executable jar.
->File->Export->Java->Runnable JAR File
Select your Launch Configuration and an Export-Destination
->Finish (Confirm the questions)
Problem at this is you pack more or less everything that is in your project’s bin-path to the jar
(all tests as well). It might help to just deselect notused src-folders and clean the project afterwards
but I’m not sure. In a test my jar-file was 44mb But who cares…
If everything is configured well you can start it by double-clicking the jar or
[java]java -jar your.jar[/java]
Best way would be to write an ant-script of your own.
Norman i love you
ttrocha the solution that norman mention worked but ill give it another try
I think using and therefore supporting jMP is always the best sollution and for sure the jar is not that big as the eclipse “fat jar”-export
Norman i love you :)
Oh wow, I didnt even think it would be that easy xD
Can you please share the experience and tell me how the imported project looked and behaved inside jMP? I have not done this yet as I dont have real Eclipse projects lying around.
Ok, first i had to import whole things from eclipse into JmonkeyPlatform
It was pain but after some solving addressing issues it worked but i had a problem:
when i was running the game inside jmp it was working but as soon as i created jar file , and by running it game crashed every time by using java command in command prompt i find out
the game cant find obj resources , the i realised in properties, in jmp as default obj are excluded from assets
pain yeah so i had to remove those flags in asset jar includes part
Oh, alright, you imported the code… Theres also an option to import ecplise projects under File->Import Project (they can even be synced back). But as said I dont know how well it works.
hello… I have the same problem with the topic…
I was created jar files in jmonkey alpha4, it has successfully built…
The problem is everytime I execute the jar files I created, it always crashed…
What can I do, so that the jar files I created wouldn’t crash…
Please help me. Thank a lot!
Crashes how? Please give us something to go on? There are any of a million reasons that an application can crash.
The instruction at “0x0475c5b5” referenced memory at “0x048bb600”. The memory could not be “read”.
Click on OK to terminate the program
That is the popup error found when I executed the jar files created. I have loaded all the models, scenes, etc. In assets. But when I run it to windows console this is the error found:
Sep 13, 2011 11:01:41 PM com.jme3.material.MaterialDef
INFO: Loaded material definition: Default GUI
Sep 13, 2011 11:01:41 PM com.jme3.asset.DesktopAssetManager loadAsset
WARNING: Cannot locate resource: Scenes/town/main.scene
Sep 13, 2011 11:01:41 PM com.jme3.app.Application handleError
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
at java.lang.Thread.run(Unknown Source)
This is the line where your error is:
How are you running it on the windows console?
And “Scenes/town/main.scene” is not on the classpath.
C:paht_location>java -jar “GameCreated.jar”
When I run the program in the platform it always run successfully and no errors found…
But when I created jar files and I executed it the jar files doesn’t load successfully
The “Scenes/town/main.scene” located at assets…and I loaded it to class road();
It is not finding your assets.jar for some reason.
JMP creates GameCreated.jar in the dist directory with a lib sub-directory where all of your other jars live. If you move the main jar then you must also move the lib directory.
So, where exactly are you running the jar file in relation to where the lib directory is.
See, for me… the command would have looked like: java -jar dist/GameCreated.jar
thanks pspeed… I will try it later after my class…
you must convert your .scene to .j3o and use that instead. .scene .ogre.xml, .obj etc… are removed and not put in assets.jar
^^ Ah, good catch. I didn’t even think of the .scene issue.