Fix template to start with unique directory to avoid permissions issues.
Also make JDK5 fixes.