Solved

NullPointerException

Posted on 2001-08-05
12
222 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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
 

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
object oriented programming comparison 5 69
java jdbc batch example 8 29
hibernate example using maven 12 41
jsp login check 12 27
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

816 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

8 Experts available now in Live!

Get 1:1 Help Now