Handling exception Java<->C++.