OESF Portables Forum

Everything Else => Zaurus - Everything Development => Distros, Development, and Model Specific Forums => Archived Forums => Personal Java/Jeode/J2ME Personal Profile => Topic started by: aig on May 12, 2004, 05:05:05 pm

Title: Executing Java app from shell script
Post by: aig on May 12, 2004, 05:05:05 pm
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: [Select]
#!/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
Title: Executing Java app from shell script
Post by: Tehas on May 12, 2004, 11:40:38 pm
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...
Title: Executing Java app from shell script
Post by: ak on May 15, 2004, 08:39:24 am
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]
Title: Executing Java app from shell script
Post by: gatho on May 25, 2004, 04:20:11 am
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