Some updates to work not only with SUN JDK.