Author Topic: Executing Java app from shell script  (Read 7136 times)

aig

  • Newbie
  • *
  • Posts: 31
    • View Profile
    • http://www.gianfagna.net
Executing Java app from shell script
« 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
OZ 3.5.2 on SL-5000D, 32-0.
SMC 2642W Wi-Fi, Targus CF Modem
Viking 1 GB CF, Piel Frama leather case

Tehas

  • Full Member
  • ***
  • Posts: 157
    • View Profile
    • http://users.adelphia.net/~stonerrl/rick/
Executing Java app from shell script
« Reply #1 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...
+SL-5600 v1.32 ROM (Special pre-emptive kernel with overclock)  +Viking 256CF  +SimpleTech 256CF  +Viking 128SD (as ext2)  +AmbiCom WL1100C +Micro Innovations KB  +Hawking Ethernet CF  
+SL6000L +Lexar 1GB SD (as ext2)  +Windows 98/Me/Nt/XP  +Mandrake 8.1 My Zaurus Page[img]http://users.adelphia.net/~stonerrl/rick/rls_userbar.gif\" border=\"0\" class=\"linked-sig-image\" /]

ak

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • http://
Executing Java app from shell script
« Reply #2 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]

gatho

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • http://
Executing Java app from shell script
« Reply #3 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