Use trigger_error instead of die().
Add compatible java version.