I am having problems running my java program. It compiles with no errors, but when I attempt to run it, I get runtime errors. The question is the line numbers it points to are not in my program. I have only 800 lines, but the error is line 1121. I assume this is due to the imports. How can I see the bad line of code ? I am using TextPad and SDK 1.4.2_01..
Thanks
Charlie
java runtime errors
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
- talleyrand
- Posts: 624
- Joined: Mon Jul 21, 2003 6:56 pm
- Location: Kansas City, MO, USA
- Contact:
While this is a question probably better suited to a true Java forum, if Keith has no objections, let's see what's going on in your code. What's the specific error being produced?
I choose to fight with a sack of angry cats.
Run Time errors
The error is NullPointerException at JMenu.createActionComponent (JMenu.java:647) at JMenu.add(JMenu.java:625) at <init>(java:177) at main(java:468)
- talleyrand
- Posts: 624
- Joined: Mon Jul 21, 2003 6:56 pm
- Location: Kansas City, MO, USA
- Contact:
Re: Run Time errors
Granted, I am tired but I fail to see line 1121 mentioned in your error message. If you're being duplicitous, don't. People on here are usually pretty receptive to answer problems when they can (remember we don't get paid for doing this. We're just people who really enjoy TP and like to spread the word and occasionally pick up some wicked tips and tricks)ezchucky wrote:The error is NullPointerException at JMenu.createActionComponent (JMenu.java:647) at JMenu.add(JMenu.java:625) at <init>(java:177) at main(java:468)
Having said that, it appears that in your main function (public static void main(String argv)) at line 468 you are attempting to add an object to an instance of JMenu that is null. I don't do GUIs for a very good reason so I can't make a guess as to what you are doing wrong but look at that line and the preceding lines dealing with the instance of JMenu and whatever object/params you are passing to to it. Make sure those values (toString() is handy for this) appear to be what you expected.
I choose to fight with a sack of angry cats.
Run Time errors
Sorry, those numbers were just an example. Actually my program is 481 lines. But the line numbers for the error messages are correct...
I am very grateful for the help...
Thanks !!!!!!!!!!!!!!!11
Charlie
I am very grateful for the help...
Thanks !!!!!!!!!!!!!!!11
Charlie
- talleyrand
- Posts: 624
- Joined: Mon Jul 21, 2003 6:56 pm
- Location: Kansas City, MO, USA
- Contact:
If you are looking to see what the code looks like for an imported class, you will be out of luck unless you wrote it, have the source or have a decompiler handy (if it's standard Swing classes it won't decompile and you can probably assume it's coding correctly).
If you are looking to turn on line numbering in TP, View -> Line Numbers Control-G will give you the option of jumping to whatever line (or column/page/Byte/Bookmark) you'd like.
If you are looking to turn on line numbering in TP, View -> Line Numbers Control-G will give you the option of jumping to whatever line (or column/page/Byte/Bookmark) you'd like.
I choose to fight with a sack of angry cats.