title: JAR fails to load com.microsoft.sqlserver.jdbc.sqlserverdriver
body: <p>There seems to be a number of similar questions related to this, but none have been able to provide me with any help. I'm running <em>Microsoft's JDBC driver</em> on <em>SQL Server</em>  (I am using <code>sqljdbc4.jar</code>) and using integrated authentication to access my database. The code snippet for connecting is as follows:</p>
  
  <pre><code>String connectionUrl="jdbc:sqlserver://servername:1433;integratedSecurity=true;";
  
  try {
      Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
      con = DriverManager.getConnection(connectionUrl);
  }//catch, etc...
  </code></pre>
  
  <p>When I run the project in <strong>Eclipse</strong>, it starts up without a hitch. When I run <strong>Maven</strong> clean install and pack it into a .jar, however, I get the error:</p>
  
  <pre><code>java.lang.ClassNotFoundException: Failure to load: com.microsoft.sqlserver.jdbc.SQLServerDriver
      at launch.JarClassLoader.loadClass(JarClassLoader.java:964)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Unknown Source)
      at ui.SearchWindow$1.run(SearchWindow.java:97)
      at java.awt.event.InvocationEvent.dispatch(Unknown Source)
      at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
      at java.awt.EventQueue.access$200(Unknown Source)
      at java.awt.EventQueue$3.run(Unknown Source)
      at java.awt.EventQueue$3.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
      at java.awt.EventQueue.dispatchEvent(Unknown Source)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
      at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
      at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
      at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
      at java.awt.EventDispatchThread.run(Unknown Source)
  </code></pre>
  
  <p>I have attempted the solutions posted in other threads; I have a System <code>CLASSPATH</code> variable that directs to the <code>.jar</code> and it is located in my build path and my runtime classpath. Perhaps the problem is staring me in the face. My best guess is that it is related to Maven, but how should I go about solving this?</p>
  
  <p>Also, please let me know if I need to clarify any points; I'd be more than happy to do so.</p>