Shutdown if java cannot be found on PATH

This addresses #239 and includes some refactoring.