Added error handling for the Java App Class to avoid issues.