Link to home
Start Free TrialLog in
Avatar of srikanthradix
srikanthradixFlag for United States of America

asked on

Executing a Jar File through Unix script

It is calling Main-Class in jar file but the classpath is not set weirdly. It is giving me some class not found from the libraries.
#!/bin/ksh
 
DIR=`dirname  $0`
 
# Set new class path
echo "Setting classpath"
 
CLASSPATH=${DIR}/config
 
for i in `ls -1 lib/*.jar`; do
   CLASSPATH=${CLASSPATH}:${DIR}/${i}
done
 
`java -jar -cp $CLASSPATH -Ddir=${DIR} zones.jar`
 
exit 0

Open in new window

Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Just make sure the classpath and DIR is what you want by echoing them before you execute java (for which you don't need backticks)
SOLUTION
Avatar of omarfarid
omarfarid
Flag of United Arab Emirates image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of srikanthradix

ASKER

Manifest thing did the trick. Thanks
:-)