Skip to content
9 changes: 9 additions & 0 deletions common.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,3 +403,12 @@ export function setupPath(newPathEntries) {
core.addPath(newPath.join(path.delimiter))
return msys2Type
}

export function setupJavaHome() {
core.startGroup(`Modifying JAVA_HOME for JRuby`)
let newHomeVar = `JAVA_HOME_21_${os.arch().toUpperCase()}`;
let newHome = process.env[newHomeVar];
console.log(`Setting JAVA_HOME to ${newHomeVar} path ${newHome}`)
core.exportVariable("JAVA_HOME", newHome);
core.endGroup()
}
4 changes: 4 additions & 0 deletions ruby-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ export async function install(platform, engine, version) {
// Set the PATH now, so the MSYS2 'tar' is in Path on Windows
common.setupPath([path.join(rubyPrefix, 'bin')])

if (engine == "jruby") {
common.setupJavaHome();
}

if (!inToolCache) {
await io.mkdirP(rubyPrefix)
await downloadAndExtract(platform, engine, version, rubyPrefix)
Expand Down
Loading