Changed to use native methods from JVM. Issue: #330