This content has been marked as final. Show 7 replies
When you catch an exception, don't make up your own text, or at least use the text of the exception's message in addition to your own text. Otherwise you can't possibly find out what the exception really means.
Well this is what i got , I dont understand a thing!
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at cliThreadT3.run(cliThreadT3.java:55) -> code here -> if(in.ready())
at cliT3.<init>(cliT3.java:40) -> code here -> A blank line after the catch block
at MyHandler3.actionPerformed(examp3.java:154)->code here-> String host = "pesonal"; new cliT3(host); creating a client
the rest below seems to be from the java itself. . .
The "in" above is an variable of BufferedReader type
and it is obviously null
and the exception occurs in code which you haven't showed us
and whose source code clearly doesn't correspond to the .class file being executed
and it is not an IOException at all, is it?
The "in" above is an variable of BufferedReader typeThis is pathetic.
Where in the code you posted is the Swing code?
You have no socket problem. You might have a Swing programming question. And probably what you really have is a total lack of knowing what you are doing which is a problem you on your own need to solve.
As it turns out both of you are right.
It is a null and the socket program works fine in the dos prompt.
The thing is I am trying to take the input from a text area and send it over the socket and display it, a chat box if you may. . .
But I am not able to get the text from the text area, it just sets it to null. . .
I am using the getText() method.
I am sorry if I sound dumb, it s just that I am in a place where I know too much to be a newbie but too less to be a pro like a no mans land, but thanks for all the help guys.
How about taking some of the implicit advice offered here? Recompile and redeploy your code. Rerun the test. Look at the stack trace. Go to that line in your source code. Fix the NPE or whatever it is. If you can't, post the new stack trace and the block of code it occurs in here.
If you don't do all that you can't rationally anybody to be able to help you here.