title: What's the difference between running the application from netbeans and running the jar?
body: <p>I have a java application that works perfectly when running from Netbeans 7.1 but it crashes if I use the build jar.</p>
  
  <p>I've been investigating the problem and I've noticed that the application holds on calling DriverManager.getConnection(). </p>
  
  <p>I'm doing something like: </p>
  
  <pre><code>Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); 
  Connection con =   DriverManager.getConnection("jdbc:sqlserver://127.0.0.1:2304;user=username;password=12345;database=databasename");
  </code></pre>
  
  <p>I've also tried jtds but it has the same result. </p>
  
  <p>I'm running on Windows 7 Home Premium
  SQL Server 2008 (localhost) 
  Netbeans 7.1 (application works fine when running from Netbeans)
  Java Version 1.6</p>
  
  <p>Thread dump </p>
  
  <pre><code>java.lang.Exception: Stack trace
      at java.lang.Thread.dumpStack(Unknown Source)
      at joomlasyncrnzr.JoomlaSyncrnzrApp.getCon(JoomlaSyncrnzrApp.java:314)
      at joomlasyncrnzr.JoomlaSyncrnzrApp.taxas(JoomlaSyncrnzrApp.java:604)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.jdesktop.application.ApplicationAction.noProxyActionPerformed(Ap
  licationAction.java:662)
      at org.jdesktop.application.ApplicationAction.actionPerformed(ApplicatinAction.java:698)
      at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
      at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
      at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
      at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
      at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
      at java.awt.Component.processMouseEvent(Unknown Source)
      at javax.swing.JComponent.processMouseEvent(Unknown Source)
      at java.awt.Component.processEvent(Unknown Source)
      at java.awt.Container.processEvent(Unknown Source)
      at java.awt.Component.dispatchEventImpl(Unknown Source)
      at java.awt.Container.dispatchEventImpl(Unknown Source)
      at java.awt.Component.dispatchEvent(Unknown Source)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
      at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
      at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
      at java.awt.Container.dispatchEventImpl(Unknown Source)
      at java.awt.Window.dispatchEventImpl(Unknown Source)
      at java.awt.Component.dispatchEvent(Unknown Source)
      at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
      at java.awt.EventQueue.access$000(Unknown Source)
      at java.awt.EventQueue$1.run(Unknown Source)
      at java.awt.EventQueue$1.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
      at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
      at java.awt.EventQueue$2.run(Unknown Source)
      at java.awt.EventQueue$2.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.AccessControlContext$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>What could be causing this? </p>