abonorio All American 9344 Posts user info edit post |
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 object
public 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 |
confusi0n All American 5076 Posts user info edit post |
did you redefine System.out ? 4/20/2006 12:24:44 PM |
moron All American 34142 Posts user info edit post |
Maybe try making Dummy store some value (like int e=9 or something). 4/20/2006 12:38:55 PM |
Shaggy All American 17820 Posts user info edit post |
can you paste the full code thats causing the error and the stack trace? 4/20/2006 12:41:37 PM |
confusi0n All American 5076 Posts user info edit post |
oh where is esgargs when you need him 4/20/2006 1:01:01 PM |
abonorio All American 9344 Posts user info edit post |
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 |
abonorio All American 9344 Posts user info edit post |
stack trace:
Null Pointer Exception
java.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 |
abonorio All American 9344 Posts user info edit post |
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 |
Shaggy All American 17820 Posts user info edit post |
i dunno. thats wierd as hell 4/20/2006 1:41:16 PM |
zorthage 1+1=5 17148 Posts user info edit post |
at lotus.domino.AgentLoader.loadClass(Unknown Source)
That looks sketch to me. As long as the class was in the classpath (shouldn't matter if . is in it or not) as long as its explicitly in the classpath it should work fine. What's this an addin for?4/22/2006 1:20:49 AM |
dakota_man All American 26584 Posts user info edit post |
is their java api 1:1 w/ their c++ api? 4/22/2006 12:33:31 PM |