Fixed a JVM crash effecting all platforms.
Tweaked the build file to fix issues on all platforms.