开发者

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.ja开发者_JAVA百科r

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?


Try exporting the CLASSPATH variable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜