• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help debugging and running My GUI TCP Chatroom!

 
Nathan Jones
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20659
64
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Nathan Jones
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fixed that problem...thanks. Still needs a bunch of tweaking but i appreciate your help!
 
Rob Spoor
Sheriff
Pie
Posts: 20659
64
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic