Solved

NullPointerException

Posted on 2001-08-05
12
218 Views
Last Modified: 2012-06-27
Hi
Can any one suggest me..
 When i am compling my program.I got the error as :

"DFParser.java": Error #: 2301 : internal compiler error: java.lang.NullPointerException

My program is littlebit bit big (1500 line). how to solve this problem ?

waiting for reply.
Kapil.
0
Comment
Question by:kapil009
  • 5
  • 2
  • 2
  • +2
12 Comments
 
LVL 9

Expert Comment

by:yongsing
ID: 6354339
Look at the stack trace and see which line the exception occurs.
0
 

Author Comment

by:kapil009
ID: 6354752
Hi Yonqsinq
Error occurs in complation not while running the program.
0
 
LVL 9

Expert Comment

by:yongsing
ID: 6354812
A NullPointerException is thrown during runtime. It seems to be thrown by the compiler. Which compiler are you using?
0
 
LVL 3

Expert Comment

by:dnoelpp
ID: 6354835
Maybe this is a bug by your compiler. I suggest you to isolate the problem. Then, when you've isolated it, you can work-around it.

How to isolate it?

Comment out the half of your program and recompile it. (You should comment out in a way that you don't introduce compiler errors like missing methods, etc.) If the NullPointerException doesn't happen anymore, you know, the problem is inside the commented-out region. Repeat the steps still you have cornered the mysterious bug. If you work in small steps and methodically, you can find the bug of the compiler rather fast (less than a day).

A small hint: It is bad programming style to have a big class (I assume your "program" is a single, big class). It is better to split up your program into entities, into so called objects. If you have a single object with very large methods, then you are still programming in the old-fashioned procedure-oriented way.

I think, you wouldn't have had this problem this way.

Good luck!
0
 
LVL 3

Expert Comment

by:dnoelpp
ID: 6354840
An example on how to comment out:

You have a method

int countParsedStrings(String[] strings) {
    ...
    lots of code
    ...
}

Comment it out this way:

int countParsedStrings(String[] strings) {
    //...
    //lots of code
    //...
    return new String[] {};
}

Most editors have a command to comment out whole blocks. I configured JBuilder that on the press of Shift-Escape the current line is commented out or in. If I have a block selected, all lines of the blocks are commented out or in.
0
 
LVL 3

Expert Comment

by:dnoelpp
ID: 6354844
Ah, sorry, should be

return 0; // instead of return new String[] {}
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Expert Comment

by:yoavdo
ID: 6433165
Do U get the same error when using the javac command?
sometimes Vendors compiler like borland's Jbulider have lots (and that is an under statment) bug, most of them accurs after long hours, and booting your compiler might help, any way, using the javac command should not give u this error.
0
 
LVL 3

Expert Comment

by:dnoelpp
ID: 6433757
That's bullshit, dear friend yoavdo. JBuilder is an IDE, not a compiler. The problems you encountered can be memory problems. Buy more RAM. Software developing is resource-intensive...
0
 

Author Comment

by:kapil009
ID: 6457590
Thanx ..

I have used different complier and the problem solved.

0
 
LVL 3

Expert Comment

by:dnoelpp
ID: 6457693
Very well!

You can have this question deleted (ask Community Support), or you can give your points to one of us experts anyway because we looked at your problem and tried to help you. It's you who decides...
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 7020149
ADMINISTRATION WILL BE CONTACTING YOU SHORTLY.  Moderators Computer101, Netminder, Mindphaser or I will return to finalize these as soon as possible if after 7 days no response by the Asker.  EXPERTS-->  please post closing recommendations before that time.

Below are your open questions as of today.  Questions which have been inactive for 21 days or longer are considered to be abandoned and for those, your options are:
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you, but may help others. You must tell the participants why you wish to do this, and allow for Expert response.  This choice will include a refund to you, and will move this question to our PAQ (Previously Asked Question) database.  If you found information outside this question thread, please add it.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question (if it has no potential value for others).
   --> Post comments for expert of your intention to delete and why
   --> YOU CANNOT DELETE A QUESTION with comments; special handling by a Moderator is required.

For special handling needs, please post a zero point question in the link below and include the URL (question QID/link) that it regards with details.
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click this link for Help Desk, Guidelines/Member Agreement and the Question/Answer process.  http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

Click you Member Profile to view your question history and please keep them updated. If you are a KnowledgePro user, use the Power Search option to find them.  

Questions which are LOCKED with a Proposed Answer but do not help you, should be rejected with comments added.  When you grade the question less than an A, please comment as to why.  This helps all involved, as well as others who may access this item in the future.  PLEASE DO NOT AWARD POINTS TO ME.

To view your open questions, please click the following link(s) and keep them all current with updates.
http://www.experts-exchange.com/questions/Q.11531878.html
http://www.experts-exchange.com/questions/Q.20143798.html
http://www.experts-exchange.com/questions/Q.20153601.html
http://www.experts-exchange.com/questions/Q.20156894.html
http://www.experts-exchange.com/questions/Q.20163587.html
http://www.experts-exchange.com/questions/Q.20176408.html
http://www.experts-exchange.com/questions/Q.20176440.html
http://www.experts-exchange.com/questions/Q.20176441.html
http://www.experts-exchange.com/questions/Q.20177690.html
http://www.experts-exchange.com/questions/Q.20177691.html
http://www.experts-exchange.com/questions/Q.20177694.html
http://www.experts-exchange.com/questions/Q.20177695.html
http://www.experts-exchange.com/questions/Q.20177682.html
http://www.experts-exchange.com/questions/Q.20178349.html
http://www.experts-exchange.com/questions/Q.20178788.html
http://www.experts-exchange.com/questions/Q.20178790.html
http://www.experts-exchange.com/questions/Q.20178930.html
http://www.experts-exchange.com/questions/Q.20181832.html
http://www.experts-exchange.com/questions/Q.20182527.html
http://www.experts-exchange.com/questions/Q.20132139.html
http://www.experts-exchange.com/questions/Q.20297508.html



*****  E X P E R T S    P L E A S E  ******  Leave your closing recommendations.
If you are interested in the cleanup effort, please click this link
http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643
------> POINTS FOR EXPERTS awaiting comments are listed in the links below
http://www.experts-exchange.com/commspt/Q.20277028.html (Part 1)
http://www.experts-exchange.com/jsp/qShow.jsp?ta=commspt&qid=20295853 (Part 2)
 
Moderators will finalize this question if in @7 days Asker has not responded.  This will be moved to the PAQ (Previously Asked Questions) at zero points, deleted or awarded.
 
Thanks everyone.
Moondancer
Moderator @ Experts Exchange
0
 
LVL 1

Accepted Solution

by:
Moondancer earned 0 total points
ID: 7020152
21 questions remain open today, some date back to the year 2000.  I will close those I can today, and request that Asker attend to the rest as quickly as possible.

This question has been closed, 50 points refunded, asker found own solution; but never closed it.

Moondancer - EE Moderator
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
mergeTwo  challenge 13 72
triangle challenge 4 77
strCopies  challenge 17 73
Understanding websocket example in spring 1 42
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now