diff --git a/bin/ruby-build b/bin/ruby-build index fced4b51..46b7d84e 100755 --- a/bin/ruby-build +++ b/bin/ruby-build @@ -687,7 +687,7 @@ fix_rbx_irb() { } require_java7() { - local version="$(java -version 2>&1 | head -1)" + local version="$(java -version 2>&1 | grep 'java version' | head -1)" if [[ $version != *1.[789]* ]]; then colorize 1 "ERROR" >&3 echo ": Java 7 required. Please install a 1.7-compatible JRE." >&3 diff --git a/test/build.bats b/test/build.bats index d88083b9..037d95db 100644 --- a/test/build.bats +++ b/test/build.bats @@ -589,6 +589,18 @@ DEF assert_success } +@test "Java version string not on first line" { + cached_tarball "jruby-9000.dev" bin/jruby + + stub java "-version : echo 'Picked up JAVA_TOOL_OPTIONS' >&2; echo 'java version \"1.8.0_31\"' >&2" + + run_inline_definition <