Running JAR file on AIX via KornShell script

I run the following command on my AIX machine.

/usr/java6_64/jre/bin/java -jar myapp.jar

Then, things look fine. The JAR file connects to the database and does whatever it needs to do.

But I need to put this command (plus a few others) in a script.

So I created a KornShell (ksh) script file called "script.ksh" to do the above.

#!/bin/ksh
/usr/java6_64/jre/bin/java -jar myapp.jar

But it is giving me the following exception:

EXCEPTION:  TerminateProcessException: Cannot connect to the database.
 java.sql.SQLException: No suitable driver

Now, there is a "lib" folder in the same location as the JAR file and script.ksh file where the JDBC driver is located.

Is there something I am missing in the shell script? Like classpath? I tried setting the classpath in the script with

CLASSPATH=/home/path/to/lib/*.jar

But it still gave me the error. Looks like it can't find the driver. Any help?


尝试导出CLASSPATH变量。

链接地址: http://www.djcxy.com/p/17520.html

上一篇: 奇怪的行为

下一篇: 通过KornShell脚本在AIX上运行JAR文件