Here is the stack trace:
Exception in thread "main" java.lang.NoClassDefFoundError: com/microsoft/jdbc/sq
lserver/SQLServerDriver
at com.dbinterface.DatabaseAccess.execute(DatabaseAcc ess.java:108)
at com.dbinterface.DatabaseAccess.loadSqlfiles(Databa seAccess.java:81)
at com.dbinterface.DatabaseAccess.getFileList(Databas eAccess.java:39)
at com.dbinterface.RunSqlScripts.main(RunSqlScripts.j ava:24)
This is the method where the error is thrown -
Expand|Select|Wrap|Line Numbers
- public void execute(StringBuffer sb)
- {
- Connection conn = null;
- Statement stmt = null;
- ResultSet rs = null;
- try{
- DriverManager.registerDriver(new com.microsoft.jdbc.sqlserver.SQLServerDriver());
- conn = DriverManager.getConnection(Constants.DATABASE_NAME, Constants.USERNAME, Constants.PASSWORD);
- stmt = conn.createStatement();
- stmt.execute(sb.toString());
- rs.close();
- stmt.close();
- conn.close();
- }
- catch(Exception e)
- {
- e.printStackTrace();
- }
- finally
- {
- try{
- if(null != rs)
- rs.close();
- if(null != stmt)
- stmt.close();
- if(null != conn)
- conn.close();
- }
- catch(Exception e)
- {
- e.printStackTrace();
- }
- }
- }
[HTML]<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry exported="true" kind="lib" path="C:/temp/dbInterface/sqljdbc.jar"/>
<classpathentry exported="true" kind="lib" path="C:/temp/dbInterface/msbase.jar"/>
<classpathentry exported="true" kind="lib" path="C:/temp/dbInterface/mssqlserver.jar"/>
<classpathentry exported="true" kind="lib" path="C:/temp/dbInterface/msutil.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>[/HTML]
My jar file is located in C:/temp/dbInterface.
This is what my MANIFEST.MF file contains:
Manifest-Version: 1.0
Main-Class: com.dbinterface.RunSqlScripts
Please help. As far as I see my classpaths are correct. I'm not sure what to try from here.
------------UPDATE------------
I just attempted adding the classpaths to my manifest so it would now look like:
Manifest-Version: 1.0
Class-Path: .;C:\temp\dbInterface\msbase.jar;C:\temp\dbInterfa ce\mssqlserver.jar;C:\temp\dbInterface\msutil.jar; C:\temp\dbInterface\sqljdbc.jar
Main-Class: com.dbinterface.RunSqlScripts
Still didn't work. I quite desperate at this point.