I’ve got an application, where I use a JDBC connection. When I run it from the Eclipse environment, there’s no problem.
But, when I pack it into jar, the line
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
causes an exception:
java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
I put a line into manifest file, but it didn’t help:
Class-Path: sqljdbc4.jar
Can anyone help?
I finally solved the problem.
I installed the jdbc driver also on the remote server, and I packed the files to an executable jar (not only jar as before).