Can jme programs run directly from the .jar executable file after compilation?

the command in command prompt im using to execute the program is:

java -jar mygame.jar



however, my program does not display everything when executed from cmd prompt.

only certain objects seem to appear in the environment.



kindly advise. thanks

tried with more space for the vm? I execute my programs always with -Xmx512m

If everything was properly compiled and you aren’t running into RAM issues, you can run things just fine that way. I launch Mythruna that was all the time… even without expanding the memory (though it’s not entirely pleasant to do so. ;))



Are you hard-coding any paths to things that might not be found or are you using the AssetManager to load everything?

Hi pspeed



Thanks for the response. Yes we are using AssetMange to load everthing is there a complication with it ?



This is my code please help me go through it and see whats the problem with it thanks !!!



public void simpleInitApp() {

try {





initb[0] = false; initb[1] = true;

flyCam.setMoveSpeed(20);



buildSky();

buildMap();

initlists();

setupKeys(); //input handling



///////////////use rmi, call settraflight and setpassengers once

}



catch (Exception e) {

System.out.println(e + “…”);

}



// buildCamera();



}

private void buildMap() {



int[][][] map, newMap;

MapReader mR = new MapReader(“DummyMapSample.txt”);

map = mR.readMap();



int a = mR.getLayer();

int b = mR.getRow();

int c = mR.getColumn();

Material[] matArr = new Material[b*c]; // assuming 20x25 map = 500 grid

Box[] boxArr = new Box[b*c];

Geometry[] geo = new Geometry[b*c];



for (int i = 0, k = 0; i < b; i++) {

for (int j = 0; j < c; j++) {

// draw each box with relative positioning to the prev

boxArr[k] = new Box(new Vector3f(-1 + (2 * i), -1, 1 + (2 * j)),

1, 1, 1);

k++;

}

}



for (int i = 0; i < b*c; i++) {

matArr = new Material(assetManager, “Common/MatDefs/Misc/”

  • “ColoredTextured.j3md”);

    //matArr.setTexture(“m_ColorMap”, assetManager.loadTexture(

    // “Models/Grass/grass.jpg”));

    }



    newMap = SwapMap(map, a, b, c);

    DrawMap(newMap, matArr, a, b, c);



    //assign geom to boxes and attach to rootnode to show

    for (int i = 0; i < bc; i++) {

    geo = new Geometry(“Boxsafhs”, boxArr);

    geo.setMaterial(matArr);

    rootNode.attachChild(geo);

    }

    }



    public void DrawMap(int[][][] map, Material[] matArr, int a, int b, int c) {

    int m = 0;



    DirectionalLight sun = new DirectionalLight();

    sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f));

    rootNode.addLight(sun);



    DirectionalLight sun2 = new DirectionalLight();

    sun2.setDirection(new Vector3f(20.1f, -0.7f, 20.0f));

    rootNode.addLight(sun2);



    for (int i = 0; i < a; i++) {

    for (int j = 0; j < b; j++) {

    for (int k = 0; k < c; k++) {

    if (m == b
    c) {

    m %= bc;

    }

    if(map[j][k] == 20) {

    matArr[m++].setTexture(“m_ColorMap”,

    assetManager.loadTexture(“Models/Road/road20.jpg”));

    }

    else if (map[j][k] == 21) {

    matArr[m++].setTexture(“m_ColorMap”,

    assetManager.loadTexture(“Models/Road/road21.jpg”));

    }

    else if (map[j][k] == 22) {

    matArr[m++].setTexture(“m_ColorMap”,

    assetManager.loadTexture(“Models/Road/troad22.jpg”));

    }

    else if (map[j][k] == 23) {

    matArr[m++].setTexture(“m_ColorMap”,

    assetManager.loadTexture(“Models/Road/troad23.jpg”));

    }

    else if (map[j][k] == 24) {

    matArr[m++].setTexture(“m_ColorMap”,

    assetManager.loadTexture(“Models/Road/troad24.jpg”));

    }

    else if (map[j][k] == 25) {

    matArr[m++].setTexture(“m_ColorMap”,

    assetManager.loadTexture(“Models/Road/troad25.jpg”));

    }

    else if (map[j][k] == 26) {

    matArr[m++].setTexture(“m_ColorMap”,

    assetManager.loadTexture(“Models/Road/roadCur26.jpg”));

    }

    else if (map[j][k] == 27) {

    matArr[m++].setTexture(“m_ColorMap”,

    assetManager.loadTexture(“Models/Road/roadCur27.jpg”));

    }

    else if (map[j][k] == 28) {

    matArr[m++].setTexture(“m_ColorMap”,

    assetManager.loadTexture(“Models/Road/roadCur28.jpg”));

    }

    else if (map[j][k] == 29) {

    matArr[m++].setTexture(“m_ColorMap”,

    assetManager.loadTexture(“Models/Road/roadCur29.jpg”));

    }

    else if (map[j][k] == 40) {

    matArr[m++].setTexture(“m_ColorMap”,

    assetManager.loadTexture(“Models/Road/xroad40.jpg”));

    }

    else if (map[j][k] == 50) {

    matArr[m++].setTexture(“m_ColorMap”,

    assetManager.loadTexture(“Models/Road/zroad50.jpg”));

    }

    else if (map[j][k] == 51) {

    matArr[m++].setTexture(“m_ColorMap”,

    assetManager.loadTexture(“Models/Road/zroad51.jpg”));

    }

    else if (map[j][k] == 11 || map[j][k] == 12 || map[j][k] == 13 || map[j][k] == 14) {



    Spatial highrise = assetManager.loadModel(“Models/highrise/highrise.j3o”);

    highrise.setLocalTranslation(14.2f, 0, 4.6f);

    highrise.scale(.9f,1.3f,.9f);

    rootNode.attachChild(highrise);



    if (map[j][k] == 11 || map[j][k] == 12 || map[j][k] == 13 || map[j][k] == 14) {

    highrise.setLocalTranslation(-1.8f+2
    j, 0, 0.6f+2*k);

    highrise.scale(.9f,1.3f,.9f);

    rootNode.attachChild(highrise);

    }



    m++;



    }

    else if (map[j][k] == 60 || map[j][k] == 61 || map[j][k] == 62 || map[j][k] == 63) {

    Spatial busStop = assetManager.loadModel(“Models/busStop/busStop.j3o”);

    busStop.scale(.25f,.1f,.25f);



    if (map[j][k] == 60) {

    busStop.setLocalTranslation(-2+(j+1)2-2, 0, k2+1);

    busStop.setLocalRotation(new Quaternion(new float[] { 0, new Double((Math.toRadians(180))).floatValue(), 0 }));

    slist[numOfStop] = new TrackerBusStop(this, j, 24-k, ‘N’, 9);

    }

    else if(map[j][k] == 61) {

    busStop.setLocalTranslation(-2+(j+1)2, 0, 2+k2-1);

    slist[numOfStop] = new TrackerBusStop(this, j, 24-k, ‘S’, 9);

    }

    else if(map[j][k] == 62) {

    busStop.setLocalTranslation(-2+(j+1)2-1, 0, k2);

    busStop.setLocalRotation(new Quaternion(new float[] { 0, new Double((Math.toRadians(90))).floatValue(), 0 }));

    slist[numOfStop] = new TrackerBusStop(this, j, 24-k, ‘E’, 9);

    }

    else if(map[j][k] == 63) {

    busStop.setLocalTranslation(-2+(j+1)2-2+1, 0, 2+k2);

    busStop.setLocalRotation(new Quaternion(new float[] { 0, new Double((Math.toRadians(270))).floatValue(), 0 }));

    slist[numOfStop] = new TrackerBusStop(this, j, 24-k, ‘W’, 9);

    }

    Spatial girl4 = assetManager.loadModel(“Models/girl/girl.j3o”);

    girl4.scale(0.04f, 0.04f, 0.04f);

    girl4.setLocalTranslation(-2+(j+1)2-1, 0, 2+k2-1);

    rootNode.attachChild(girl4);

    m++;

    rootNode.attachChild(busStop);



    System.out.println("stops id = " + slist[numOfStop].getStopID());

    numOfStop++;

    System.out.println("num bstop = " + numOfStop);

    }

    else if (map[j][k] == 70) { // NS direction





    Spatial girl4 = assetManager.loadModel(“Models/girl/girl.j3o”);

    girl4.scale(0.04f, 0.04f, 0.04f);

    girl4.setLocalTranslation(-2+(j+1)2-1, 0, 2+k2-1);

    rootNode.attachChild(girl4);



    tlist[numOfLight] = new TrackerTLight(this, j, 24-k, 1, initb);

    System.out.println("light id = " + tlist[numOfLight].getLightID());

    numOfLight++;

    System.out.println("numtlight = " + numOfLight);

    m++;



    }

    else if (map[j][k] == 71) { // EW direction



    Spatial girl4 = assetManager.loadModel(“Models/girl/girl.j3o”);

    girl4.scale(0.04f, 0.04f, 0.04f);

    girl4.setLocalTranslation(-2+(j+1)2-1, 0, 2+k2-1);

    rootNode.attachChild(girl4);

    tlist[numOfLight] = new TrackerTLight(this, j, 24-k, 2, initb);

    System.out.println("light id = " + tlist[numOfLight].getLightID());

    numOfLight++;

    System.out.println("numtlight = " + numOfLight);

    m++;



    }

    else if (map[j][k] == 72) { // intersection





    Spatial girl4 = assetManager.loadModel(“Models/girl/girl.j3o”);

    girl4.scale(0.04f, 0.04f, 0.04f);

    girl4.setLocalTranslation(-2+(j+1)2-1, 0, 2+k2-1);

    rootNode.attachChild(girl4);

    tlist[numOfLight] = new TrackerTLight(this, j, 24-k, 0, initb);

    System.out.println("light id = " + tlist[numOfLight].getLightID());

    numOfLight++;

    System.out.println("numtlight = " + numOfLight);

    m++;



    }



    else if (map[j][k] == 0) {

    matArr[m++].setTexture(“m_ColorMap”, assetManager.loadTexture(

    “Models/Grass/grass.jpg”));

    }

    else {

    m++;

    }

    }

    }

    }

    }

No problem with asset manager… in fact that will save you. :slight_smile:



Can you repost your code in a Java block to make it easier to read? Maybe someone will spot something. I’m on my way to bed or I’d look deeper but it hurts my eyes. :slight_smile:



…and by repost, I mean edit your post and put it in a Java block.