Factor Jython detection code into detect_executable