Enhanced Java version to cancel from externals.