(Apple Silicon) aarch64 OpenJDK detect and install
This commit is contained in:
parent
ecfe0de0fb
commit
dcac771011
@ -302,7 +302,7 @@ class JavaGuard extends EventEmitter {
|
||||
break
|
||||
}
|
||||
|
||||
const url = `https://corretto.aws/downloads/latest/amazon-corretto-${major}-x64-${sanitizedOS}-jdk.${ext}`
|
||||
const url = `https://corretto.aws/downloads/latest/amazon-corretto-${major}-${process.arch.includes("arm") ? "aarch64" : "x64"}-${sanitizedOS}-jdk.${ext}`
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
request.head({url, json: true}, (err, resp) => {
|
||||
@ -495,6 +495,8 @@ class JavaGuard extends EventEmitter {
|
||||
let vendorName = props[i].split('=')[1].trim()
|
||||
this.logger.debug(props[i].trim())
|
||||
meta.vendor = vendorName
|
||||
} else if (props[i].indexOf('os.arch') > -1) {
|
||||
meta.isARM = props[i].split('=')[1].trim() === 'aarch64'
|
||||
}
|
||||
}
|
||||
|
||||
@ -866,6 +868,9 @@ class JavaGuard extends EventEmitter {
|
||||
* @param {string} dataDir The base launcher directory.
|
||||
* @returns {Promise.<string>} A Promise which resolves to the executable path of a valid
|
||||
* x64 Java installation. If none are found, null is returned.
|
||||
*
|
||||
* Added: On the system with ARM architecture attempts to find aarch64 Java.
|
||||
*
|
||||
*/
|
||||
async _darwinJavaValidate(dataDir){
|
||||
|
||||
@ -894,7 +899,13 @@ class JavaGuard extends EventEmitter {
|
||||
pathArr = JavaGuard._sortValidJavaArray(pathArr)
|
||||
|
||||
if(pathArr.length > 0){
|
||||
return pathArr[0].execPath
|
||||
let amd64Path = pathArr.find(({ isARM }) => !isARM).execPath
|
||||
let armPath = pathArr.find(({ isARM }) => isARM).execPath
|
||||
if (process.arch.includes("arm")) {
|
||||
if (armPath) return armPath
|
||||
return null
|
||||
}
|
||||
return amd64Path
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user