Invoking java from a bash terminal via shell script fails under Mint Debian
I am running a Java application on the command line bash terminal under Mint Debian. I have JDK1.6.0_22 installed 64-bit, and the OS is 64-bit too. I have a few JAR files in the directory and a few native LWJGL libraries. When I run the application using the command line, all works fine.
Lets assume my directory where the files are is called /home/riz/MyGame. I change to that directory and this is the command I use: Code:
java -classpath MyGame.jar:log4j-1.2.16.jar:jme/jme-colladabinding.jar:jme-audio.jar:jme-awt.jar:jme-collada.jar:jme-editors.jar:jme-effects.jar:jme-font.jar:jme-gamestates.jar:jme-model.jar:jme-ogrexml.jar:jme-scene.jar:jme-swt.jar:jme-terrain.jar:jme.jar:jogl/gluegen-rt.jar:jogl/jogl.jar:jorbis/jorbis-0.0.17.jar:junit/junit-4.1.jar:lwjgl/jinput.jar:lwjgl/lwjgl.jar:lwjgl/lwjgl_util.jar:lwjgl/lwjgl_util_applet.jar:swt/windows/swt.jar:jbullet/jbullet-jme.jar:jbullet/asm-all-3.1.jar:jbullet/jbullet.jar:jbullet/stack-alloc.jar:jbullet/vecmath.jar:trove-2.1.0.jar:sceneMonitor/jmejtree_jme2.jar:sceneMonitor/propertytable.jar:sceneMonitor/scenemonitor_jme2.jar:sceneMonitor/sm_properties_jme2.jar -Djava.library.path="lwjgl/native/linux" -Xmx1024m -Xms768m -ea com.mygame.Main The problem occurs when I try to run this command via a shell script. Here is my script (located under /home/riz/MyGame): Code:
#!/bin/bash Code:
14-Feb-2011 19:46:28 com.wcg.game.DefaultUncaughtExceptionHandler uncaughtException I am running Linux Mint Debian 201012, Linux mint 2.6.32-5-amd64 #1 SMP Thu Nov 25 18:02:11 UTC 2010 x86_64 GNU/Linux. JDK is 1.6.0_22 64-bit. I have 64-bit .so files in the correct place too as the Java command works. Also, file permissions are correct. I have also tried the absolute file path: -Djava.library.path="/home/riz/MyGame/lwjgl/native/linux" and this does not work either, same error trace. There must be something obvious I am missing. I call the shell script from bash like this: Code:
sh MyGame.sh Any tips, ideas most welcome. Thanks Riz |
Have you tried changing to the directory it's located at when the script starts? It's been awhile since I've worked in Linux, but I believe a shell started from a script starts off in the user's home directory. That may be the problem, sorry if I'm wrong but like I said, it's been awhile and sometimes it seems like I'm starting all over.
|
I'd guess, the shell script should start with :
Line 1 : #!/bin/bash Line 2 : cd /home/riz/MyGame |
Thanks for all your suggestions. I have solved the problem. The line:
Code:
_VM_PROPERTIES='-Djava.library.path="lwjgl/native/linux"' Code:
_VM_PROPERTIES=-Djava.library.path="lwjgl/native/linux" Thanks again Riz |
All times are GMT -5. The time now is 06:25 AM. |