Improved the login dialog. Fixed exception handling in JNI.