error detials:

Java Plug-in 10.17.2.02
Using JRE version 1.7.0_17-b02 Java HotSpot(TM) Client VM
User home directory = C:\Users\dave
----------------------------------------------------
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
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 <n>
----------------------------------------------------
CacheEntry[http://localhost/E_COMMERCE/menu_pages/game_pages/java_game_2/Main.class]: updateAvailable=true,lastModified=Wed Mar 20 22:46:02 EDT 2013,length=6945
Exception in thread "AWT-EventQueue-6" java.lang.NullPointerException
    at dave.Main.paint(Main.java:198)
    at sun.awt.RepaintArea.paintComponent(Unknown Source)
    at sun.awt.RepaintArea.paint(Unknown Source)
    at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$200(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

main.java

line197: public void paint(Graphics g) {
line198:      background_class.paint(g, this);
line199:      ground_class.paint(g);         
line200:      player_class.paint(g);         
.....

so i think error is saying that background_class on line198 is null. so i added a println statment

System.out.println("flag1 = "+background_class);
 background_class.paint(g, this);
 System.out.println(flag2 + "+background_class);

output:
flag1 = dave.Background@24dfb3be
flag2 = dave.Background@24dfb3be

so there is some value in it? so why does error say its null?????????

Recommended Answers

All 2 Replies

I don't see a stack trace in the output you listed. If background_class.paint(g, this) caused a NullPointerException then your flag2 println would never have happened, so then you must have changed something which fixed the problem.

If the exception isn't being thrown then why are you surprised that background_class is not null?

ops forgot to say this is an japplet. and on eciplse it works fine and there are no error. that why i am able to print the value of background_class.

the error is on the webpage. when i try to load this japplet on webpade than i get this long error about line 198 being null.

so that why i add the print statments to see the values.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.