title: Run a jar using a shell file and specify classpath and properties file path
body: <p>I've compiled a Spring Maven project JAR. My dependencies are all in a directory labeled lib. How to execute my JAR while specifying it should use the LIB/* as the classpath and also use log4j.xml and a properties file called marker.properties. My marker.sh</p>
  
  <pre><code>LIB=$INSTALL_PATH/lib
  echo "$LIB"  # outputs usr/local/app/lib
  export CLASSPATH=$(JARS=("$LIB"/*.jar); IFS=:; echo "${JARS[*]}")
  PARM="-Dlog4j.configuration=/usr/local/Marker/log4j.xml"
  java $PARM -jar /usr/local/Marker/marker-1.0.jar
  </code></pre>
  
  <p>But on running this I get the following error as it is not able to find the jars in the classpath</p>
  
  <pre><code>Exception in thread "main"java.lang.NoClassDefFoundError: org/springframework/context/ConfigurableApplicationContext                   at java.lang.Class.getDeclaredMethods0(Native method)
  </code></pre>
  
  <p>However, this command is able to load the jar from classpath, but I am unable to add the properties file</p>
  
  <pre><code>java -cp /usr/local/Marker/marker-1.0.jar:"$LIB"/* com.package.Marker
  </code></pre>