 <p>You are adding data to both <code>Vectors</code> with out initializing them.</p> <pre><code>Vector data; Vector columns; </code></pre> <p>Initialize them before you add elements.</p> <pre><code>Vector data = new Vector(); Vector columns = new Vector(); </code></pre> <p>Check after doing this whether you are getting <a href="http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/NullPointerException.html" rel="nofollow">NullPointerException</a> or not.</p> <p>If still you are getting <code>NPE</code> then I doubt that you didn't initialize <code>JTable</code>. So post code to make us know where exactly exception is coming.</p>