Cant load model with material

I exported my model from blender with ogre meshes and it game me a .xml and a .material

I can get it to make the model tnx for a quick copy and paste of a tutorial. but when i run the app my model is all red.

I think its because im not useing my material but i tryed to load it and it wont work

It says com.jme3.scene.plugins.ogre.OgreMaterialList cannot be cast to com.jme3.material.Material

this is the code please help me.

package mygame;

import com.jme3.math.Vector3f;
import com.jme3.renderer.RenderManager;
import com.jme3.light.DirectionalLight;
import com.jme3.scene.Spatial;

import com.jme3.material.Material;

 * test
 * @author normenhansen
public class Main extends SimpleApplication {

    public static void main(String[] args) {
        Main app = new Main();

    public void simpleInitApp() {

       // Load a model from test_data (OgreXML + material + texture)
        Spatial ninja = assetManager.loadModel("Models/Cube.mesh.xml");
        Material mat = assetManager.loadMaterial("Materials/Scene.material");
        ninja.scale(0.05f, 0.05f, 0.05f);
        ninja.rotate(0.0f, -3.0f, 0.0f);
        ninja.setLocalTranslation(0.0f, -5.0f, -2.0f);
        // You must add a light to make the model visible
        DirectionalLight sun = new DirectionalLight();
        sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f));


    public void simpleUpdate(float tpf) {
        //TODO: add update code

    public void simpleRender(RenderManager rm) {
        //TODO: add render code

forget about the Scene.material it's not what you need.

here is a link to a previous thread where i explain how to make your own j3m material file (it's really quick and easy)

Or you can read the helloMaterial wiki page that is pretty instructive

this should help

im haveing trouble because JMP is telling me that it cant find "Common/MatDefs/Light/ColoredTextured.j3md"

There i got it to work.

The code i used was.

Spatial ninja = assetManager.loadModel("Models/Cube.mesh.xml");

And my j3m file looks like

Material Tree : Common/MatDefs/Misc/SimpleTextured.j3md{
   MaterialParameters {
                m_ColorMap: Textures/prisstex.jpg

Now what do i do if i wanna make it shiny and have a bump map layer?

You have to use the Lighting material definition

your material should look like this

Material YourMaterial : Common/MatDefs/Light/Lighting.j3md {
   MaterialParameters {
       m_Shininess: 8.0
       m_DiffuseMap: Textures/YourMaterial_diffuse.png
                 m_NormalMap: Textures/YourMaterial_normal.png
       m_SpecularMap: Textures/YourMaterial_spec.png

There are a lot more parameters in this material definition like alphamap, vertex color, parallax map, etc...
If you want a complete description, i suggest you browse the JME3 sources and look in Lighting.j3md

If you don't want to use a parameter you just have to omit it in the j3m file.