# Error message while executing the shell script

**URL:** <https://community.unix.com/t/error-message-while-executing-the-shell-script/177008>\
**Category:** Shell Programming and Scripting\
**Created:** [October 25, 2007, 3:38am UTC](https://community.unix.com/t/error-message-while-executing-the-shell-script/177008 "2007-10-25T03:38:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajayyaduwanshi](https://community.unix.com/letter_avatar/ajayyaduwanshi/32/6_22734026db12803ebb3e059622ac3534.png) [@ajayyaduwanshi](https://community.unix.com/u/ajayyaduwanshi)\
**Post date:** [October 25, 2007, 3:38am UTC](https://community.unix.com/t/error-message-while-executing-the-shell-script/177008/1 "2007-10-25T03:38:21Z")

</div>

# Hi All, When I am trying to execute the below shell script I got this error message. script

#!/bin/bash  
/usr/java/jdk1.5.0\_10/bin/java - classpath /var/lib/asterisk/agi-bin/mysql-connector-java-3.0.15-ga-bin.jar/:  
/var/lib/asterisk/agi-bin/jarfiles:  
/var/lib/asterisk/agi-bin/800PBXMAIN.jar: com pbx main PBXMain $1 $2 $3 $4 $5 $6 $7

# Error

Unrecognized option: -  
Could not create the Java virtual machine.  
./800PBXMAIN.sh: line 3: /var/lib/asterisk/agi-bin/jarfiles:: No such file or directory  
./800PBXMAIN.sh: line 4: /var/lib/asterisk/agi-bin/800PBXMAIN.jar:: No such file or directory

The jarfiles directory and 800PBXMAIN.jar file are in their respective directories.

Thanks & Regards

Ajay Singh Yaduwanshi  
😃

---

<div class="post-metadata">

**Author:** ![ajcannon](https://community.unix.com/letter_avatar/ajcannon/32/6_22734026db12803ebb3e059622ac3534.png) [@ajcannon](https://community.unix.com/u/ajcannon)\
**Post date:** [October 25, 2007, 4:34am UTC](https://community.unix.com/t/error-message-while-executing-the-shell-script/177008/2 "2007-10-25T04:34:55Z")

</div>

Well I am no java developer but I don't think there should be a space between the "-" and classpath

---

<div class="post-metadata">

**Author:** ![ajayyaduwanshi](https://community.unix.com/letter_avatar/ajayyaduwanshi/32/6_22734026db12803ebb3e059622ac3534.png) [@ajayyaduwanshi](https://community.unix.com/u/ajayyaduwanshi)\
**Post date:** [October 25, 2007, 5:15am UTC](https://community.unix.com/t/error-message-while-executing-the-shell-script/177008/3 "2007-10-25T05:15:22Z")

</div>

Hi,  
Thanks for your reply, the vary first error is removed because of your suggestion, however I am still getting No such file or directory error for  
800PBXMAIN.jar file and the directory jarfiles, even though the file and the directory is present in the folder.I also changed the mode of the file and the directory to RWX.

Thanks & Regards

Ajay Singh Yaduwanshi

---

<div class="post-metadata">

**Author:** ![ajayyaduwanshi](https://community.unix.com/letter_avatar/ajayyaduwanshi/32/6_22734026db12803ebb3e059622ac3534.png) [@ajayyaduwanshi](https://community.unix.com/u/ajayyaduwanshi)\
**Post date:** [October 25, 2007, 6:05am UTC](https://community.unix.com/t/error-message-while-executing-the-shell-script/177008/4 "2007-10-25T06:05:01Z")

</div>

Hi,  
I have written the script in the single line. after that

I am getting Exception in thread "main" java.lang.NoClassDefFoundError: com/pbx/main  
while executing the script , this is the only error I am getting now.

Thanks & Regards

Ajay Singh Yaduwanshi

---

<div class="post-metadata">

**Author:** ![ajayyaduwanshi](https://community.unix.com/letter_avatar/ajayyaduwanshi/32/6_22734026db12803ebb3e059622ac3534.png) [@ajayyaduwanshi](https://community.unix.com/u/ajayyaduwanshi)\
**Post date:** [October 25, 2007, 7:12am UTC](https://community.unix.com/t/error-message-while-executing-the-shell-script/177008/5 "2007-10-25T07:12:38Z")

</div>

Hi All,  
The above classdef not found error got eliminated Since I have not put dot after com.pbx.main.PBXMain, However I am getting the below error.  
java.lang.ClassNotFoundException: com.pbx.PBX800Sample  
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)  
at java.security.AccessController.doPrivileged(Native Method)  
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)  
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)  
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)  
at com.pbx.main.PBXMain.main(PBXMain.java:100)

Let me explain you in brief what I did actually, I have created a jar file named 800PBXMAIN.jar containing the PBXMain class which is having a main method and also the jar file is having property file in which I define the path another jar file name PBX800Sample.jar which is being called by our main program, the path set in the property file is like 800PBXMAIN(Key)=/var/lib/asterisk/agi-bin/jarfiles, IN the jarfiles folder I kept PBX800Sample.jar.  
My reformated code is

#!/bin/bash  
/usr/java/jdk1.5.0\_10/bin/java -classpath /var/lib/asterisk/agi-bin/mysql-connector-java-3.0.15-ga-bin.jar:/var/lib/asterisk/agi-bin/jarfiles:/var/lib/asterisk/agi-bin/800PBXMAIN.jar: com.pbx.main.PBXMain $1 $2 $3 $4 $5 $6 $7

Please help me get out of this issue.

Thanks & Regards

Ajay Singh Yaduwanshi
