Jar issue

I have a program that works perfectly when on my computer but throws exceptions when put into an executable jar.



When the jar is executing a JFrame pops up, with 3 buttons, asking to join a game, host a game, or go into the option menu. Now when you click on one what should happen is that a JPanel is created  which is added to the center of the JFrame's Borderlayout. But when this program is in a Jar instead i get a nullpointer exeception. What makes this even weirder is that the exeception is only thrown after the first click. For instance, i click on Join once, and nothing happens, no exception, no new JPanel. Click it again, and then the exception is thrown.

I have a feeling i don't know something about jar's and am making a basic mistake. Help :frowning:



The following is the Exception thrown and its printStackTrace()


Exception thrown: java.lang.NullPointerException
   java.lang.Thread.dumpThreads(Native Method)
   java.lang.Thread.getStackTrace(Unknown Source)
   com.RoT.utils.Console.reportError(Console.java:94)
   com.RoT.setup.SetupScreen$ButtonPanel.actionPerformed(SetupScreen.java:85)
   javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
   javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
   javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
   javax.swing.DefaultButtonModel.setPressed(Unknown Source)
   javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
   java.awt.Component.processMouseEvent(Unknown Source)
   javax.swing.JComponent.processMouseEvent(Unknown Source)
   java.awt.Component.processEvent(Unknown Source)
   java.awt.Container.processEvent(Unknown Source)
   java.awt.Component.dispatchEventImpl(Unknown Source)
   java.awt.Container.dispatchEventImpl(Unknown Source)
   java.awt.Component.dispatchEvent(Unknown Source)
   java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
   java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
   java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
   java.awt.Container.dispatchEventImpl(Unknown Source)
   java.awt.Window.dispatchEventImpl(Unknown Source)
   java.awt.Component.dispatchEvent(Unknown Source)
   java.awt.EventQueue.dispatchEvent(Unknown Source)
   java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
   java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
   java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   java.awt.EventDispatchThread.run(Unknown Source)

Are you using the same class path information executing from the jar you used before?

i am simpy double clicking on it

how would add classpath info to it?



edit: ok i added the class path, but still no go…

Also a different class was working which was outside of the folder, i don't think this is classpath

drfugly said:

edit: ok i added the class path, but still no go...
Also a different class was working which was outside of the folder, i don't think this is classpath


I am having difficulty understanding what you mean. Can you clarify what you did and what you mean by the different class?

Just to make sure we are talking about the same thing

What are these two lines:


com.RoT.utils.Console.reportError(Console.java:94)
com.RoT.setup.SetupScreen$ButtonPanel.actionPerformed(SetupScreen.java:85)



The stack trace seems to suggest that's where your problem lies. :-p

darkfrog