Help - Search - Members - Calendar
Full Version: Executing Java app from shell script
OESF Forums > Distros, Development, and Model Specific Forums > Everything Development > Personal Java/Jeode/J2ME Personal Profile
aig
Hello,

I am rather new at using shell scripts, so I was wondering if anyone could tell me what I am doing wrong here. This is the simple script I put in a file called guitest.sh. I execute it from the working directory /root/Documents with: sh guitest.sh

However I get a "java.lang.NoClassDefFoundError: ZGUI" error back from evm. I can execute the command with the whole classpath stuff in there directly from bash without a problem, but when I throw it in a script I get this error. I am getting into using the Zaval light weight gui components and I wanted to make a script so I wouldn't have to type the classpath stuff in every time I opened up the shell. Thanks.

Note that the "evm -cp ... ZGUI" is on one line but it seems phpBB won't display it that way.
CODE
#!/bin/bash

echo "Starting Java GUI Test..."

evm -cp .:/mnt/card/root/Documents/:/root/Documents/lw.jar:/mnt/card/opt/QtPalmtop/lib/awt.jar:/mnt/card/opt/QtPalmtop/lib/core.jar:/root/Documents/lwtext.jar ZGUI

exit 0


~AIG
Tehas
Looks OK to me. Try running the script without the sh command ... at the command prompt, you should be able to just key in the script name and press enter (you do need the .sh extention to the name).

I'm assuming that your class file is in the same directory as the shell script and that you're in that directory when running the script.

How do you like the Zaval libraries? I saw them when they first came out and they look interesting. How do they perform?

Good luck...
ak
I call JAVA Programms the following way,
all classes are included into the jar's
works with and without calling a separate shell
works with and without the "cd" (I use it as I use relative paths within the programm)

#!/bin/bash
cd /mnt/card/myPath/
evm -XappName=runPdc -cp /mnt/card/myPath/Pdc.jar:/mnt/card/myPath/hsqldbz.jar xx.yy.pdc.PdcMain
======
Install the hsqldbz package (java-hsqldb_1.0.1_arm.ipk)
and have a look at the installed files:
/home/QtPalmtop/apps/Jeode/hsqldb.desktop
/home/QtPalmtop/bin/runhsqldb
Gives a good start.[/quote]
gatho
I used to have a similar problem. I had my application main class packed in a jar file, say "myApp.jar". It worked after I explicitly included this jar file into the class path. Including just the local directory (".") doesn't seem to be enough. In this case evm seems to look for a file "myApp.class" rather than "myApp.jar".

Hope this helps.

Thomas
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.