Fix compilation and execution of scripts to run on OpenJDK and OracleJDK 6+