I haven't coded java since 316. So here's my problem. I'm getting a NullPointerException when I try to create an object inside of the ActionPerformed() method of an AWT button. Here's my objectpublic class Dummy { public Dummy() { System.out.println("test"); }}And it's just being called inside the Action Performed method: public void actionPerformed(ActionEvent event) { try { Dummy d = new Dummy(); } catch(NullPointerException npe) { System.out.println("Null Pointer Exception"); npe.printStackTrace(); } }And it's wigging out on the declaration for the 'd' variable... Am I just not seeing the overly obvious answer here?
4/20/2006 11:33:32 AM
did you redefine System.out ?
4/20/2006 12:24:44 PM
Maybe try making Dummy store some value (like int e=9 or something).
4/20/2006 12:38:55 PM
can you paste the full code thats causing the error and the stack trace?
4/20/2006 12:41:37 PM
oh where is esgargs when you need him
4/20/2006 1:01:01 PM
Well the code is alot... not sure if you want it all (about 5 classes in all). I'm 100% positive this is where the error is. I can comment out the call to Dummy and it runs fine without the npe.I'm thinking it has to do something with the inheritance from the AWT class where the Dummy object is created... but that just seems unlikely...
4/20/2006 1:09:06 PM
stack trace:Null Pointer Exceptionjava.lang.NullPointerException at lotus.domino.AgentLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(ClassLoader.java:448) at PrintReminderWindow.actionPerformed(PrintReminderWindow.java:116) at java.awt.Button.processActionEvent(Button.java:344) at java.awt.Button.processEvent(Button.java:317) at java.awt.Component.dispatchEventImpl(Component.java:2678) at java.awt.Component.dispatchEvent(Component.java:2581) at java.awt.EventQueue.dispatchEvent(EventQueue.java:434) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:141) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:132) at java.awt.EventDispatchThread.run(EventDispatchThread.java:124)bold is the only place where there's a non API call made.
4/20/2006 1:21:40 PM
figured it out.compiling and running with the -cp . worked.Defining the classpath as current did the trick... hmm, is this new with the latest version of java that you have to explicitly define the classpath? Why doesn't it take "." to be default?
4/20/2006 1:38:43 PM
i dunno. thats wierd as hell
4/20/2006 1:41:16 PM
at lotus.domino.AgentLoader.loadClass(Unknown Source)
4/22/2006 1:20:49 AM
is their java api 1:1 w/ their c++ api?
4/22/2006 12:33:31 PM