Use javascript to imitate jdk