Move exception classes to java