How to run jme3 project in command prompt

Hello,

I like to run my jme3 project (programmed with jme3 platform) in the command line. I use the following command to run my project (compiling with javac is no problem, I think):



[java]java -Djava.endorsed.dirs=/dir/to/jar/libs MainClass[/java]



But I have one problem related to the use of textures in my project. When I run my project via command prompt I become the following error: “java.lang.IllegalArgumentException: The given texture parameter is not set.” because the texture can not be found. I load a texture in my code with the following code:



[java]mat.setTexture(“DiffuseMap”, app.getAssetManager().loadTexture(“Textures/texture1.jpg”));[/java]



The texture is located in the folder: …/projectFolder/assets/Textures/texture1.jpg. I think I have to add this path to the java command. But I don’t know how to do this. Can anyone help me?

As stated at the end of the build process, go to the dist directory and use “java -jar MyGame.jar” to start the game.

Unfortunately, that is not what I want. I’d like to compile the project completely via the command promt; as if the jme3 platform does not exists. This is necessary, because some classes of my project will be generated from a high level specification. So, I have to compile the complete code in a build process via the command prompt. Do you have any idea?

Ah, you need ant for that, then just call “ant dist” in the root of the project.

hey normen



What do you mean by calling “ant dist”? Do you mind giving a more specific example?

http://ant.apache.org/ will maybe get you started.

safetyguard said:
This is necessary, because some classes of my project will be generated from a high level specification.

jMP uses normal ant build scripts. You can extend the build process in any way you like.
normen said:
As stated at the end of the build process, go to the dist directory and use "java -jar MyGame.jar" to start the game.


Hi normen -- As a follow-up on this, I have a model used in my program at ([PROJECT]/assets/Models/cave-FULL.mesh.xml) and I too need to actually call the program from the command line. However, I get:

`pre type="php"`
 Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]

com.jme3.asset.AssetNotFoundException: Models/Cave-FULL.mesh.xml

        at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:236)

        at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:373)

        at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:383)

        at mygame.Main.simpleInitApp(Main.java:90)

        at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:230)

        at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:124)

        at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:200)

        at java.lang.Thread.run(Thread.java:655)


`/pre`

I am new to the Java side of things so if you would happen to know how to run "java -jar MyGame.jar" from the dist folder but such that it also can pull in those items in my /assets folder that would really be a great help. Thanks.
gradpole said:
Hi normen -- As a follow-up on this, I have a model used in my program at ([PROJECT]/assets/Models/cave-FULL.mesh.xml) and I too need to actually call the program from the command line. However, I get:

I am new to the Java side of things so if you would happen to know how to run "java -jar MyGame.jar" from the dist folder but such that it also can pull in those items in my /assets folder that would really be a great help. Thanks.


Check if your model is actually in the assets.jar located in [PROJECT]/dist/lib.
I think JMP packs only the converted models in the assets.jar.