wood burning stoves 2.0*
The moose likes Sockets and Internet Protocols and the fly likes Help debugging and running My GUI TCP Chatroom! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Help debugging and running My GUI TCP Chatroom!" Watch "Help debugging and running My GUI TCP Chatroom!" New topic
Author

Help debugging and running My GUI TCP Chatroom!

Nathan Jones
Greenhorn

Joined: Dec 03, 2010
Posts: 6
Hello all,
I've been at this for a while, and need some input. Maybe I am just not seeing the problem and need some fresh eyes. The server compiles and run's fine. The client compiles, but then when ran I get an error "Exception in thread "main" java.lang.NullPointerException
at MyChatClient3.main(MyChatClient3.java:118)"
If you guys could take a look it would be much appreciated. Any input would be helpful! Thanks!

Here is the client (Where the problem lies)


and here the is the server (which runs fine)
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19655
    
  18

Nathan Jones wrote:

You create a JFrame here alright, but you assign it to a local variable, not your static field. The static JFrame frame remains null.

Which makes me wonder - why are some of your fields static? They look like they belong to one single chat client, and therefore should be instance (non-static) fields.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Nathan Jones
Greenhorn

Joined: Dec 03, 2010
Posts: 6
Fixed that problem...thanks. Still needs a bunch of tweaking but i appreciate your help!
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19655
    
  18

You're welcome.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help debugging and running My GUI TCP Chatroom!
 
Similar Threads
Help with Head First Java simplechatclient -- NullPointerException
server client relationship is not good! :(
Usability features
I need help improving this chat server and chat client!
How do you formally disconect a client from a server?