The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Error executing shell command from a perl script voorkey Shell Programming and Scripting 3 02-19-2008 02:37 PM
Suppress error message in shell script newbie07 Shell Programming and Scripting 3 12-31-2007 03:44 AM
Executing a Shell Script igandu UNIX for Dummies Questions & Answers 4 08-17-2006 07:29 AM
Shell script is not executing dreams5617 UNIX for Advanced & Expert Users 5 08-20-2004 08:45 AM
Executing a SQL query from a shell script 98_1LE UNIX for Dummies Questions & Answers 3 03-22-2002 11:29 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-25-2007
Registered User
 

Join Date: Oct 2007
Posts: 4
Error message while executing the shell script

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
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 10-25-2007
Registered User
 

Join Date: Aug 2007
Location: Binfield, Berkshire. UK
Posts: 91
Well I am no java developer but I don't think there should be a space between the "-" and classpath
Reply With Quote
  #3 (permalink)  
Old 10-25-2007
Registered User
 

Join Date: Oct 2007
Posts: 4
Error while excuting shell scriptHi

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
Reply With Quote
  #4 (permalink)  
Old 10-25-2007
Registered User
 

Join Date: Oct 2007
Posts: 4
Question Error while excuting shell script

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
Reply With Quote
  #5 (permalink)  
Old 10-25-2007
Registered User
 

Join Date: Oct 2007
Posts: 4
Error while excuting shell script

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
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 09:04 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0