View Single Post
Old 01-28-2013, 03:33 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,752
Thanks: 4
Thanked 2,468 Times in 2,437 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
The first one appears to be missing the external library. Make sure you add the library on the classpath when invoking it (or as a part of the manifest if its jar'd). It also appears to not be able to invoke the main method on com.spilka.server.ChatServer.

The second is simply caused by a non-instance of an object which you are attempting to dereference. To what depth, we don't know you'll need to trace the stack to get to the cause. So within the main, you can follow the tack to the q and find that something is being derferenced which is null. Perhaps the argument itself is null. It can be try/caught since its an Exception to prevent the program from terminating, but that only has use if you have a fallback to go on (which chances are would be an error message and then exit anyway).
Edit:
Maybe an example of that would help.
Code:
Integer myint = null;
try
{
    myint = Integer.parseInt("anint");
}
catch (NumberFormatException ex)
{
    // this is guaranteed to get here since 'anint' isn't parseable as an Integer.
}
System.out.println(myint.toString()); // throws NullPointerException since toString isn't available on null.
__________________
PHP Code:
header('HTTP/1.1 420 Enhance Your Calm'); 

Last edited by Fou-Lu; 01-28-2013 at 03:36 PM..
Fou-Lu is offline   Reply With Quote