This cracks me up.

I remember back in the mid-90s when Java first came out. I actually read the Java 1.0 language spec. The whole thing. It was cool. One of the folks who was telling me about it (just before I read the spec) endorsed it by saying "it's like a cleaner C++ with no pointers!" I've heard the "you don't make pointer mistakes in Java" bit a lot over the years.

Despite all that, I'm still able to convince Java to throw a java.lang.NullPointerException at me. Every time I get one (which is pretty often right now) I have to laugh just a bit because this is the a language without pointers.


Posted by jzawodn at January 09, 2003 05:42 PM

Reader Comments
# Morgan Deters said:


Problem solved. :)

I kind of like the idea of having typesafe null values. That is, each type for which a "non-value" is itself a valid value has a type-specified representation for it. For other types, null would not be a possibility. There are various benefits to this approach, from optimized JVM performance to simplified programming style. (Of course, you're merely shifting responsibility around.)

on January 9, 2003 06:30 PM
# garrett said:

i particularly like interviewing java people because with the dumb ones, you can get them on a 'java is cool because it has no pointers' kick and then spring the 'so what is a NullPointerException?' question on them. you can do the same thing with the 'java has no memory leaks' thing.

not to say java isn't cool, but it is often very overhyped...

on January 9, 2003 06:48 PM
# Andre Restivo said:

Java has pointers you just don't have to worry about them like you have in C++. In fact in Java almost everything is a pointer (only primitive types aren't).

A null pointer exception happens when you have a variable that asn't been assigned to a specific object yet.

on January 9, 2003 11:57 PM
# Sergio Carvalho said:

It's not that Java has no pointers. Its that it doesn't have pointer arithmetic. You can't get a pointer to point to an invalid memory address -- although you can have an unitialized pointer.

In fact, everything is a pointer (a reference) in Java, except for primitive types.

on January 10, 2003 03:02 AM
# Joe said:

I remember when I started to really get into Java, I would think I was doing everything so well and then spend the next few hours trying to track down one nullPointerException.

There are pointers everywhere in Java - they just don't usualy show themselves.

Pointers - we don't need no sticking pointers!!

on January 10, 2003 07:09 AM
# Daniel Bonniot said:

The fact that NullPointerException can be thrown at run time comes from the fact that Java is not smart enough to know which values might be null, and which ones cannot. The Nice language is an extension of Java that tackles this issue (among others). You need to explicitely declare in types whether the null value is allowed, by prefixing it with a question mark '?'. Thus, the compiler can check that you don't use a null value by accident in a context that doesn't accept it, and that you test for null before dereferencing when it is needed. There cannot be NullPointerException at runtime.

This issue is discussed with other safety features in this article.

Nice homepage.

on January 14, 2003 03:36 AM
# Sonia Connors said:

Amusing but can anyone tell me how to fix it so I
can do the New York Times crossword puzzle?


on February 13, 2003 09:57 AM
# Mubashir Afroz said:

I am developing a Speech Recognition Application in java using,
IBM VIA VOICE release 10 for windows, IBM Speech for java, and j2sdk1.4.0_03.
When i compile my program, the program compiles successfully, but when i try to run it i get this error:
I am really confused that why am i getting this error, plz do help me in this problem, bcaz i have been trying to solve this problem for a long time but still no success.
Actually this is my final year project and i have to submit it.
Mubashir Afroz.
contact me at:

on June 14, 2003 07:41 AM
# Denise said:

I used to play a lot of games on yahoo, now I cant play anything at all...I keep getting that same stupid line: java.lang.null/exception its driving me crazy....can someone help me, give me a hint as to what I can do to get rid of it....please

on June 17, 2003 09:28 PM
# Bob Lee said:

People who dog on NullPointerExceptions aren't handling exceptions correctly, i.e.:

catch (Exception e) {

I'll take a NullPointerException over a seg fault *any* day. I find that I don't even need a debugger with Java.

on June 24, 2003 06:30 AM
# Denise said:

If you noticed up top I was complaining because I couldnt play Yahoo games, well I found a way to do it, I got rid of the null pointer exception whatever, BUT now I cant chat.....DUH!!!

on June 27, 2003 05:18 PM
# Al said:

how do you fix the java.lang.NullPonterException? I never got them when I ran java applications using a PC, but it happens all the time on macintosh.

on July 10, 2003 04:00 AM
# geneva said:

how do you get java for pogo games to go

on August 4, 2003 12:30 PM
# Mubashir Afroz said:

After Setting the classpath. Type this command on your DOS prompt.

This will register your engine with the API that you are using (for e.g: ibmjs.jar - IBM Speech for Java).

I hope this will help you all.

Mubashir Afroz.

on November 11, 2003 11:27 AM
# Mubashir Afroz said:

Type this line on the DOS prompt and it will register your engine with the api that you are using.


But remember before this set your classpath and path variables.

Note: As i am developing a Speech Recognition System in java, so this solution worked for me, i am not sure that it will be beneficial for people developing on some other domain.

Mubashir Afroz.

on November 11, 2003 11:35 AM
# doris said:

I am havinf trouble getting java to get to pogo games. why now? I have been o.k. for amny many months now today I cant get the games to open

on September 25, 2004 12:39 PM
# Gloria said:

Hi ,

I have a problem with my chatting and experience the same problem everytime, whenever l chat jave .lang.null pointer exception appears and hinders every thing, l cannot chat now and lam very sad, can you help me with a solution?


on November 10, 2004 08:43 AM
# HK said:


I just tried that

catch (Exception e) {

thingy and it totally worked on my
while(s != null){

loop. (I put the while loop inside a try to make the catch work. duh.)

So thanks Bob Lee for suggesting that.

on November 16, 2004 08:37 AM
# Chris said:

i have the solution for the


error it is...

show me the money!!!

on December 30, 2004 09:39 PM
# Ian said:


on January 3, 2005 11:37 AM
# Ian said:

I get the error "java.lang.nullpointerException" at runtime when trying to add a new instance of an object to an array (If that makes sense?).

The line in question is:

rooms[nextRoom] = new Room(roomNo, capacity, type);

I cant for the life of me understand why :/...any ideas guys?


on January 3, 2005 11:41 AM
# Ian said:

No worries, i found it!

It was something as simple as me setting the arrays size in the syntax:

Room rooms[] = new Room(size);

...and not...

rooms = new Room(size);


on January 3, 2005 12:05 PM
# Dawn said:

i am having problems with this java.lang.nullpointerException only when i am tryin to buy one certain design of bed sheets online can anyone help me figure this out please?

on February 28, 2005 10:47 PM
# Sertac İncekli said:

I have an error "org.mozilla.JavaScriptException:java.lang.NullPointerException" help?

on June 16, 2005 03:49 AM
# Pat said:

I just wanted to thank Ian for having the same problem I did... and thus solving it for me. ;)

on July 14, 2005 01:42 PM
# Boo said:

I have some error this down . Plase help me tell solution at my
C:\axis-1_1\samples\stock>java -cp %AXISCLASSPATH% org.apache.axis.client.AdminC
lient -l http://localhost:8080/axis/services/AdminService deploy.wsdd
Processing file deploy.wsdd
Exception:: java.lang.NullPointerException

on August 12, 2005 02:05 AM
# Hal Foster said:

For NullPointerException when trying to play newspaper game in Windows, click; tools>internet options>general tab>colors> uncheck the "use windows colors" box. Keep it simple, eggheads,
some just want to use java.

on September 18, 2005 09:38 PM
# Anna said:

I have a problem with java.lang.nullpointerexception when trying to log in to internet banking.
Can some kind person please advise how to fix this problem as I am overseas and trying to check my account.
Thanks heaps

on September 22, 2005 01:12 PM
# Jason said:

I am getting the java null pointer exception as I try to connect to an I5 using RSE in WDSc 6. I have 4 iseries and can connect to all but this one. Does anyone have any ideas?

on September 27, 2005 07:04 PM
# Leigh M said:

I finally saw someone who posted something that us non-programmers can use. Thanks Hal.

I have the same problem, but I am using Firefox. I want to use Yahoo Web IM but I get that NullPointerException error, just like the folks in Win IE. But I will try Hal's recommendation.

on October 11, 2005 10:17 PM
# said:

I, too, am coming up with a runtime null pointer exception. The location of this error is the second line of the following 'for' loop:

for (int i= 0; i<theDice.length; i++) {
reroll[i]= true;

I have declared the array and all, but it returns null.

In the 'Die' class, I have declared the following variable:
int dievalue=0;

This is clearly the source of the problem, as everything that tries to reference brings up a null pointer exception. What am I doing wrong?

on November 10, 2005 07:29 PM
# shashi said:

public class NullPointerException
extends RuntimeException
Thrown when an application attempts to use null in a case where an object is required. These include:

Calling the instance method of a null object.
Accessing or modifying the field of a null object.
Taking the length of null as if it were an array.
Accessing or modifying the slots of null as if it were an array.
Throwing null as if it were a Throwable value.
Applications should throw instances of this class to indicate other illegal uses of the null object.

on December 1, 2005 01:36 PM
# squint said:

Hello, I just found this page. I have the same problem as Denise. Yahoo Freecell, my addiction, has all of a sudden stopped working. something about y.fs.0 and java.lang.NullPointerException
I don't know what this stuff is about but is there a fix?

on March 21, 2006 03:59 PM
# Review said:

Squint and to the rest of the people that read this if ou are having troublw with an internet application, getting the java.lang.nullpointerexception, this is because you need to update your java 2 platform. this use to be support by Microsoft, snd came standard with windows xp sp2. Now they don't support it hence no more automatic updates for this program. Updated it at This will get you the updates you need so that you can play certain games online as well as use certain shopping carts, that you are getting this error on. Hope this helps.

on March 28, 2006 08:10 AM
# Mandi said:

I simply cannot get into a website I am trying to view. I have read all of your comments and tried the java update and unchecking the "use windows colors" box but it has not helped me. As for the other suggestions on help, I do not understand how to do them as I am not a programmer. I need something put in simple terms that I can follow...if it actually exists! Ha Ha ...SOMEONE PLEASE HELP! =( This is the WHOLE message I am getting on my page:

500 Servlet Exception
at org.tnanytime.unclp.UNCLPSearchData.getCountyList(
at _start__jsp._jspService(/unclp/start.jsp:95)
at com.caucho.jsp.JavaPage.service(
at com.caucho.jsp.Page.subservice(
at com.caucho.server.http.FilterChainPage.doFilter(
at com.caucho.server.http.Invocation.service(
at com.caucho.server.http.CacheInvocation.service(
at com.caucho.server.http.HttpRequest.handleRequest(
at com.caucho.server.http.HttpRequest.handleConnection(

on April 2, 2006 08:44 AM
# Christopher Orr said:

The fact that this page is #2 on Google (or #6 on Yahoo) and therefore people think this is some sort of magical site that holds the cure to all NullPointerExceptions in all sorts of apps -- theirs or not -- is really quite amazing. Or amusing. Or both! :)

on April 17, 2006 04:43 PM
# Jeremy Zawodny said:

It is amusing.

on April 17, 2006 04:47 PM
# Paul said:

how do you fix the java.lang.NullPonterException? Fatal errors

on May 22, 2006 02:58 PM
# Paul said:

Check Properties...
Exception in thread "Thread-8" java.lang.NullPointerException
at javax.swing.ImageIcon.(Unknown Source)
at Source)
FATAL-ERROR: CodedValue-File did NOT exist
>>>>>>>>> EXCEPTION in constructor call of access denied ( connect,resolve)

on May 22, 2006 03:07 PM
# maha said:

I want to know how to resolve a anullpointerexception in java.

on May 23, 2006 09:24 PM
# Tunafisk said:

I spent 2 hours to find what causes the nullpointerexception.
I had the same problem what Ian had..
Vector obVector = new Vector();
I fixed it to
obVector = new Vector();
Now it works fine.

on July 26, 2006 12:43 AM
# Ariel said:


I just read through this long list of postings about the java nullpointerexception. I am having this problem when I try to chat online. I know nothing about Java or programming. None of the suggestions in this forum fixed my problem. Is there someone out there who can help me without speaking in programese? I would be very grateful.


on September 27, 2006 10:37 AM
# said:

i am displaying an array values which we retrieved from table of 3180 records it is displaying 3149 records and giving null pointer exception what should i do. query was 100% right then where it went wrong? please help me.
st2 = conn.createStatement();
s_query2="select to_char(k.trandate,'dd-mon-yyyy'), to_char(greatest(maxexpdate,maxrcptdate),'dd-mon-yyyy') recieved_upto,b.lctn_code,b.lctn_name from sto_daily_data k,lctn_mst b where(substr(b.lctn_code,instr(b.lctn_code,'#')+1) = k.stocode and (b.lctn_code like 'DTO%' OR b.lctn_code like 'STO%' ) and k.trandate between '+s_fromdate' and '+s_todate') order by substr(b.lctn_code,instr(b.lctn_code,'#')+1) ";
rs2 = st2.executeQuery(s_query2);
int i = 0;
s_trandate[i] = rs2.getString(1);
s_rcvdate[i] = rs2.getString(2);
s_loccode[i] = rs2.getString(3);
s_locname[i] = rs2.getString(4);
System.out.println("i count" +i);
for (int k =0; k < i; k++)
System.out.println("k count" +k);
if (s_trandate[k] == ""||s_trandate[k].equals("")||s_trandate[k]==null)
s_trandate[k] = " -- ";
if(s_rcvdate[k] == ""||s_rcvdate[k].equals("")||s_rcvdate[k]==null)
s_rcvdate[k] = " -- ";
i am writing this program in oracle 9i jdeveloper.

on December 4, 2006 01:06 AM
# Rj said:

Hello Evereyone trying to find a solution to the nullpointerexception. listen guys this problem is not what you can handle.. this error comes when there is something wrong with the code..

Sometimes even we programmers take days to understand the root cause of this exception, u cannot in any way solve this as a user..

Hope the websites u r visiting will update the code the webmasters to update the code..


on December 19, 2006 06:30 AM
# David Cumming said:

Ok guys, wondering if you can all help!!....Im a Student at Strathclyde University, and I really need some help with this java.lang.NullPointerException

at RunDB.executeQuery(
at RunDB.executeQuery(

this is the error i get at runtime. Im trying to get data back from a database using, the following code:

// Execute the query
public void executeQuery() throws SQLException {
boolean foundResults =
statement.execute("SELECT * FROM Transaction");
ResultSet set = statement.getResultSet();
if(set!=null) displayResults(set);
}else {
// Display the Results
void displayResults(ResultSet rs) throws SQLException {
ResultSetMetaData metaData = rs.getMetaData();
int columns=metaData.getColumnCount();
String text="";

for(int i=1;i";

....and at this point in the code:

boolean foundResults =

..It come up highlighed with the Null.Pointer error...
came anyone help??? sorry about the amount of space ive taken up, just really need some advice.
Thank you in advance

on February 7, 2007 02:19 PM
# patrick said:

Help, help. cannot access my favorite game scrabble online.

Java Plug-in 1.5.0_10
Using JRE version 1.5.0_10 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\Patrick
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
p: reload proxy configuration
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to
getCodeBase called
tournaments: 0
Running activate method in ChatPanel
redrawing boardlayer
Running activate method in ChatPanel
Loading Graphics
getCodeBase called
Contacting Server
getCodeBase called
creating reader
creating writer
creating writingThread
creating outbox buffer
starting writingThread
Waiting for Server Reply
Closing connection
Closing socket
Calling readingStopped()
Running sessionClosed()
Exception in thread "Thread-22" java.lang.NullPointerException
at Collections$
at Collections$
at Collections.sort(
at Collections.sort(
at ChatPanel.getChatID(
at UserDialog.(
at ScrabbleClientGameServerSession.sessionClosed(
at GameServerSession.readingStopped(
at StringConnectionReader$

on February 11, 2007 11:00 PM
# patrick said:

Java Plug-in 1.5.0_10
Using JRE version 1.5.0_10 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\Patrick
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
p: reload proxy configuration
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to
getCodeBase called
tournaments: 0
Running activate method in ChatPanel
redrawing boardlayer
Running activate method in ChatPanel
Loading Graphics
getCodeBase called
Contacting Server
getCodeBase called
creating reader
creating writer
creating writingThread
creating outbox buffer
starting writingThread
Waiting for Server Reply
Closing connection
Closing socket
Calling readingStopped()
Running sessionClosed()
Exception in thread "Thread-22" java.lang.NullPointerException
at Collections$
at Collections$
at Collections.sort(
at Collections.sort(
at ChatPanel.getChatID(
at UserDialog.(
at ScrabbleClientGameServerSession.sessionClosed(
at GameServerSession.readingStopped(
at StringConnectionReader$

That's the message I get every time I try to access Quadplex ony my PC. Looking for help,plz

on February 12, 2007 12:05 AM
# Kshitij Sharma said:

i am getting a nullpointerexception at the line below please suggest what may be the problem
i am using mysql 5.0.34 and tomcat 6 on a Win XP MC SP2 BOX


i am getting nullpointerexception on this line .

Please Help if you know about this bug.

on April 1, 2007 10:04 AM
# krishna said:

I have some error this down . Please help me tell solution at my

when i run the server i will get this exception what is the reason for that

at com.sun.faces.taglib.jsf_core.LoadBundleTag.doStartTag(
2)java.lang.ClassCastException: org.jboss.logging.appender.DailyRollingFileAppender

but the application runs perfectly

on August 29, 2007 03:30 AM
# Don said:

I have a problem with a nullpointerexception that I cannot figure out either. I'm fairly new to coding in Java as it is.

These are the blocks of code that throw the exception.

InputStream is = new Server().getClass().getResourceAsStream("/config/");

and 2.
Properties serverSettings = new Properties();
InputStream cfg = new Server().getClass().getResourceAsStream("/config/");

The expressions are very similar, so I'm guessing it will be the same problem with both, but I can't find it for the life of me. The exact errors I recieve at runtime are:

Exception in thread "main" java.lang.NullPointerException
at java.util.Properties$LineReader.readLine(Unknown Source)
at java.util.Properties.load0(Unknown Source)
at java.util.Properties.load(Unknown Source)
at java.util.logging.LogManager.readConfiguration(Unknown Source)
at l1j.server.Server.main(

Any help or suggestions will be much appriciated. Can contact me on MSN or via e-mail at

Thank you for your time,

on October 6, 2007 01:19 PM
# kim said:

I uninstalled the IE8beta and stopped getting the nullpointerexception for java.

on September 13, 2008 08:38 PM
# Alan said:


UnInStalled Internet Explorer 8Beta Rebooted The
Computer and The Problem Disappeared. The Explorer Beta
was Running Fine, The Problem Was Effecting My Yahoo/Games
Hold-em Poker Every-Time I Shut The Program Down, Guess
They Have Some-More Developing on IE8 Beta lol Hope
This Helps AnyOne Who Installed IE8 Beta.

on October 4, 2008 10:31 AM
# Janet Kercado said:

I'm getting a Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException .....

This is the source of my design

public class DisplayCarWash extends javax.swing.JFrame
DefaultListModel carriles[] = new DefaultListModel[6];

public static int cantidadCarriles = 5;
public static int num;
int x = 1;

/* Creates new form DisplayCarWash */
public DisplayCarWash()

private void btnNormalMouseClicked(java.awt.event.MouseEvent evt)

private void anadirCarro()
int carril = this.getCarrilVacio();
carriles[carril].addElement(new LavaCarro (;


public void Carriles()
for(int x = 0; x < cantidadCarriles; x++)
carriles[x] = new DefaultListModel();



public int getCarrilVacio()
int menor;
int CarrilPosition = 0;
menor = carriles[0].getSize();

for (int x = 0; x < cantidadCarriles ; x++)
if (carriles[x].getSize() < menor)
menor = carriles[x].getSize();
CarrilPosition = x;
return CarrilPosition;

All I'm trying to do is everytime I click the button it should create a new instance of the class LavaCarro. and then it has to search wich jList (jCarriles) has less item and and put the item in there.

I'll be more than happy if anyone could help me out here...or give me any suggestions ;) ....

on November 10, 2008 10:48 AM
# Dave said:

oh God!
i'm very glad to get you guys i have great problem about this error java.lang.NullPointerException. I'm developing speech recognition using JSAPI. please help how to fix it this is project please guys...........!?

on January 21, 2009 02:14 PM
# Christina said:

I am wondering if anyone knows what this means and how I can fix it. It's an error message that I started getting while trying to do online shopping.

ServletException in:/gid/templates/buy/shoppingBag/variant/universal1/en/JsShoppingBagFunctions.jsp] An error occurred while evaluating custom action attribute "value" with value "${requestScope.viewAdapter.isCheckoutActive}": An error occurred while getting property "isCheckoutActive" from an instance of class (java.lang.NullPointerException)' Skip Navigation:Skip to: Top Navigation, Main Content, Footer Navigation.

on April 26, 2009 04:09 PM
# Josh said:

In most cases, when the end user gets one of these errors it means simply this: The code is broken. If it is a web site, they probably have a server down or moved a resource file or graphic to the wrong place. The site is just broken and there's nothing you, the user, can do about it!

on June 15, 2009 07:11 PM
# said:

Hi, My friends having issues trying to install Football Manager 2009 onto his XP laptop. Everytime the program crashes with the following error messege:-

at javax.swing.MultiUIDefaults.getUIError(Unknown Source)
at javax.swing.UIDefaults.getUI(Unknown Source)
at javax.swing.UIManager.getUI(Unknown Source)
at javax.swing.JPanel.updateUI(Unknown Source)
at javax.swing.JPanel.(Unknown Source)
at javax.swing.JPanel.(Unknown Source)
at javax.swing.JPanel.(Unknown Source)
at javax.swing.JRootPane.createGlassPane(Unknown Source)
at javax.swing.JRootPane.(Unknown Source)
at javax.swing.JFrame.createRootPane(Unknown Source)
at javax.swing.JFrame.frameInit(Unknown Source)
at javax.swing.JFrame.(Unknown Source)
at com.zerog.ia.installer.LifeCycleManager.g(DashoA8113)
at com.zerog.ia.installer.LifeCycleManager.h(DashoA8113)
at com.zerog.ia.installer.LifeCycleManager.a(DashoA8113)
at com.zerog.ia.installer.Main.main(DashoA8113)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.zerog.lax.LAX.launch(DashoA8113)
at com.zerog.lax.LAX.main(DashoA8113)

Please help, how do I get this to stop. Im a total novice when it comes to Java ...

on July 30, 2009 01:11 PM
# James said:

Please might they send the "IBM Speech for Java" to my mail to realize my project?.

I am grateful for your support to them. =)

on August 19, 2009 03:30 AM
# tamara said:

when i checked my detailed data usage on my att wireless account online this message was what i got:[Exception in:/olam/jsp/minutes/content/UnbilledDataDetailLandingPage.jsp] null; OLAM nested exception is: com.cingular.olam.common.base.exception.CefException: Cef exception in olam class: class com.cingular.olam.server.externalinterface.cef.InquireMobile; OLAM nested exception is: java.lang.NullPointerException

from, tamara.

on October 25, 2009 09:12 PM
# tamara said:

i have two lines on the account and i was able to view the other s detailed data dut not mine. i was wondering what that ment in "english". whenever i call att with an issue i get a different answer from every single agent. thanks.

on October 25, 2009 09:24 PM
# said:


I have been getting this java.lang.NullPointerException on my BlackBerry Storm when trying to delete certain phone calls from my call log. I cannot delete them. Please help! Thank you.

on October 26, 2009 08:47 AM
# said:

Please help!

I have been getting this java.lang.NullPoinerException on my Blackberry Bold when trying to delete some phone calls from my call log. Also incoming, outgoing and missed calls are not recorded on the call log

on December 28, 2009 02:31 PM
# Hassan N said:

Package sun;
import java.util.Scanner;
public class Main
public static void main(String[] args) throws NullPointerException
int nset=2;
FoodSet[] set=new FoodSet[nset];
System.out.println("Enter name,price,numbers : ");
Scanner sc=new Scanner(;
for(int i=0;i<nset;i++)
for(int i=0;i<nset;i++)
System.out.println("name: "set[i].name" price: "set[i].price" numbers: "+set[i].name);

/******************** OutPut*******************************/
Enter name,price,numbers :
Exception in thread "main" java.lang.NullPointerException
at sun.Main.main(
Java Result: 1
BUILD SUCCESSFUL (total time: 8 seconds)

How can I solve this problem

on January 6, 2010 01:23 PM
# Miss-33 said:


So I get the java.lang.NullPointerException message when I try to use the program the comes on my WiFi Mobile Broadband modem. I go to open it, and I get the message: Cannot open Java application - Uncaught exception in main method: java.lang.NullPointerException

Any idea how to fix that? Considering I'm not programming, and it's not a problem with Java games online, using IE or Firefox or anything like that... One minute the program was working, the next, I can't even open it.

on January 24, 2010 08:18 AM
# Star CCM+ said:

at star.base.neo.ObjectRegistry$ObjectNotifyObserver.updateSpecific(
at star.base.neo.ServerObserver.update(
at java.util.Observable.notifyObservers(
at star.base.neo.NeoObservable.notifyObservers(
at star.base.neo.NeoClientNotifyHandler.executeCommand(
at star.base.neo.NeoClientNotifyHandler.executeCommands(
at star.base.neo.NeoClientNotifyHandler.access$100(
at star.base.neo.NeoClientNotifyHandler$
at star.base.neo.FJTask$
at star.base.neo.FJTaskRunner.scanWhileIdling(
[catch] at

whats the problem?

its in star ccm+ viewing the streamlines

on February 11, 2010 05:15 AM
# Adam said:

Hello guys,
For those who are asking to solve the java.lang. NullPointerException

First of all you can only solve this problem if you have access to the source code of the Apps or Applet (Program)

Otherwise forget it, for a programmer he needs hours sometimes days or even weeks to trace down the source of the exception, it's not an easy thing.

And it's NOT always an error within the code itself
it's a very tricky things to solve,

for instance I can give you a plain example:

these two sites, have a java Applet that works perfectly fine with most Browsers.

or this one

If you try these two links with FF2, Safari, Chrome, Opera, IE, 6,7 the Applet works fine but
If you load it with FF3 Firefox 3.0 and later you will get
NumberFormatException and The java.lang.NullPointerException

So it's not as easy as it looks.

I hope this helps to clarify what some people here consider to be some common error

Best of luck

on April 9, 2010 08:09 PM
# wiwill said:

Please help me! There is encaugh exception:java.lang.NullponterException when I want to open my sms, I can't. How to solve this problem? What's wrong? I can't see all message in my handphone.

on May 3, 2010 10:58 PM
# Bill said:

I can't view my bill on since they changed their system 6 weeks ago. I get this java.lang.NullPointerException message. I'm Windows XP and IE8.
They are really no help other than to tell me it's my problem. I'll bet it wouldn't be if I stopped paying the bill.

Help please, this is frustrating
Bill {-:)

on May 10, 2010 11:32 AM
# said:

Hey there...
i got stuck when i made these codes. would you like helping me please...?
here the message : "Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException"
at TataKotaTataRuang.ui.event.btnCekKuitansi.actionPerformed(

and here the codes ( line 41 = fist line)

public void actionPerformed(final ActionEvent evt) {
final int intKuitansi = ((Number)txtField.getValue()).intValue();

if (intKuitansi <= 0) {
status.setStatus("Maap NIM Tidak Boleh Kurang Dari Sama Dengan NOL !!", "ERROR");
showDialog("Maap NIM Tidak Boleh Kurang Dari \nSama Dengan NOL !!", "ERROR");

} else {
final Gudang gdgResult = gdgDao.selectGdgByKuitansi(intKuitansi);

if (gdgResult == null) {
status.setStatus("NIM " + intKuitansi +" Mahasiswa Belum Terpakai !!", "BANTUAN");
showDialog("NIM Mahasiswa : " + intKuitansi + "\n Belum Terpakai !!", "BANTUAN");
} else if (intKuitansi == gdgResult.getKuitansi()) {
status.setStatus("NIM "+ intKuitansi +" Mahasiswa Sudah Terpakai !!", "ERROR");
showDialog("NIM Mahasiswa : "+ intKuitansi +" \n Sudah Terpakai !!", "ERROR");

on May 19, 2010 07:13 PM
# Ari said:

i mean line 41 = third line :)

on May 19, 2010 07:18 PM
# Sir Kay said:

i also got this error message on my phone each time I try to open SMS inbox on my black berry. Now I can even receive sms and my sms icon cannot be found any more. Please help

on August 5, 2010 12:19 PM
Disclaimer: The opinions expressed here are mine and mine alone. My current, past, or previous employers are not responsible for what I write here, the comments left by others, or the photos I may share. If you have questions, please contact me. Also, I am not a journalist or reporter. Don't "pitch" me.


Privacy: I do not share or publish the email addresses or IP addresses of anyone posting a comment here without consent. However, I do reserve the right to remove comments that are spammy, off-topic, or otherwise unsuitable based on my comment policy. In a few cases, I may leave spammy comments but remove any URLs they contain.