add java support
modified the java snippets