开发者

Running JAR file on AIX via KornShell script

开发者 https://www.devze.com 2023-02-16 21:43 出处:网络
I run the following command on my AIX machine. /usr/java6_64/jre/bin/java -jar myapp.ja开发者_JAVA百科r

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

精彩评论

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

关注公众号