Skip to content

Commit ba75ed2

Browse files
committed
[GR-27472] JT: check jvmci version from $JAVA_HOME/bin/java -version
1 parent 7be4bd9 commit ba75ed2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tool/jt.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,13 +514,19 @@ def find_java_home
514514
java_home ||= ENV['JAVA_HOME']
515515

516516
if java_home
517+
java_home = File.realpath(java_home)
517518
if java_home.include?(jvmci_version)
519+
return :use_env_java_home
520+
end
521+
522+
java_version_output = `#{java_home}/bin/java -version 2>&1`
523+
if java_version_output.include?(jvmci_version)
518524
:use_env_java_home
519-
elsif java_home.include?('jvmci')
525+
elsif java_version_output.include?('jvmci')
520526
warn "warning: JAVA_HOME=#{java_home} is not the same JVMCI version as in common.json (#{jvmci_version})"
521527
:use_env_java_home
522528
else
523-
raise "$JAVA_HOME does not seem to point to a JVMCI-enabled JDK (#{java_home.inspect} does not contain 'jvmci')"
529+
raise "$JAVA_HOME does not seem to point to a JVMCI-enabled JDK (`#{java_home}/bin/java -version` does not contain 'jvmci')"
524530
end
525531
else
526532
raise '$JAVA_HOME should be set in CI' if ci?

0 commit comments

Comments
 (0)