MIDRANGE dot COM Mailing List Archive



Home » JAVA400-L » November 2003

Re: ClassNotFoundException onClass.forName("com.ibm.as400.access.AS400JDBCDriver");



fixed

Ron Anderson wrote:

1.  I have created a .JAR file of my application named
(myapplication.jar).
2.  I have placed myapplication.jar in a directory that also contains
all of the helper JAR files (jt400.jar, etc).

Ok so far.


3.  I call the application on the command line using:  java -jar
myapplication.jar.

I think if you are using the -jar parameter, you need to include everything in the jar file that your application needs.


5.  The application immediately does a JDBC initialization with a
Class.forName("com.ibm.as400.access.AS400JDBCDriver");   This is the
JDBC driver to connect to the AS400.
6.  I am receiving a ClassNotFoundException error on
"com.ibm.as400.access.AS400JDBCDriver".   This class is in the
jt400.jar.   I have verified this by looking at the table of contents
of jt400.jar.

This is because your JAR file does not contain the JT400 classes.


7. I have manually created a manifest file below:

Can I suggest you get your application running without doing fancy things with JAR manifests.


Your command line should look something like this:

java -classpath "application.jar;jt400.jar;<whatever else>" com.yourco.package.MainClass

After you get it running the way you want, then you can start exploring alternative packaging.

david







Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot COM and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact