sqlite - Crontab java.lang.ClassNotFoundException with a jar file -


 #!/bin/bash   java_home=/library/java/javavirtualmachines/jdk1.8.0_60.jdk  classpath=/users/sunny/crontest/out/production/crontest   $java_home/contents/home/bin/java -cp $classpath ".:/users/sunny/downloads/sqlite-jdbc-3.8.11.2.jar" sample.main   exit 0 

sqlite jar file in /users/sunny/downloads/sqlite-jdbc-3.8.11.2.jar

compiled java class file in /users/sunny/crontest/out/production/crontest/sample/main.class

and i've set cron job schedule @ every 1 minute. java class getting exucuted getting java.lang.classnotfoundexception: org.sqlite.jdbc
same command in script working in terminal.

my question how can add jar file executed shell script.

seems there space in between $class path , ".:/users/sunny/downloads/sqlite-jdbc-3.8.11.2.jar" , missing colon(:).

please try following export:

export classpath=.:/users/sunny/crontest/out/production/crontest:/users/sunny/downloads/sqlite-jdbc-3.8.11.2.jar 

and call java command -cp $classpath.

if still not work, please try -cp directly:

$java_home/contents/home/bin/java -cp ".:/users/sunny/crontest/out/production/crontest:/users/sunny/downloads/sqlite-jdbc-3.8.11.2.jar" sample.main 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -