Setting Envoirnmental variables
1) Set Java Home
2) Set Path
3) Set Class Path
4)Now call your class with java command
#!/bin/bash
export JAVA_HOME=/software/jdk/java1.6.o/
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=lib/log4j-1.2.8.jar:lib/ojdbc6.jar:lib/ejb3-persistence.jar:lib/jta.jar:lib/jdbc2_0-stdext.jar:lib/javassist.jar:lib/hibernate-tools.jar:lib/hibernate-entitymanager.jar:lib/hibernate-commons-annotations.jar:lib/hibernate-annotations.jar:lib/hibernate3.jar:lib/ehcache-1.2.3.jar:lib/dom4j-1.6.1.jar:lib/commons-logging-1.1.jar:lib/commons-collections-2.1.1.jar:lib/cglib-2.1.3.jar:lib/asm-attrs.jar:lib/asm.jar:lib/antlr-2.7.6.jar:lib/hibernate-validator.jar:lib/xbean.jar:lib/stax-api-1.0-2-sources.jar:lib/stax-api-1.0-2.jar:lib/jaxws-tools-2.2-sources.jar:lib/jaxws-tools-2.2.jar:lib/jaxws-rt-2.2-sources.jar:lib/jaxws-rt-2.2.jar:lib/jaxws-api-2.2-sources.jar:lib/jaxws-api-2.2.jar:lib/jaxb-xjc-2.2-sources.jar:lib/jaxb-xjc-2.2.jar:lib/jaxb-impl-2.2-sources.jar:lib/jaxb-impl-2.2.jar:lib/jaxb-api-2.2-sources.jar:lib/jaxb-api-2.2.jar:lib/activation-1.1-sources.jar:lib/activation-1.1.jar:lib/mailer_1_1.jar:lib/mail.jar:./config:.;
echo "CLASSPATH IS : "$CLASSPATH
$JAVA_HOME/bin/java -cp $CLASSPATH com/myapp/xml/operations/Main