[Java] Adapt serialization

Do not relies on java native serialization mechanism