mirror of
https://github.com/dscalzi/HeliosLauncher.git
synced 2024-12-22 03:32:12 -08:00
Fix auto download of jdk 17.
This commit is contained in:
parent
3837588ecd
commit
5d52d3d201
@ -478,8 +478,7 @@ class JavaGuard extends EventEmitter {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(verOb.major >= 16) {
|
||||
// TODO Make this logic better. Make java 16 required.
|
||||
} else if(verOb.major >= 17) {
|
||||
// Java 9+
|
||||
if(Util.mcVersionAtLeast('1.17', this.mcVersion)){
|
||||
meta.version = verOb
|
||||
@ -1559,9 +1558,10 @@ class AssetGuard extends EventEmitter {
|
||||
// Java (Category=''') Validation (download) Functions
|
||||
// #region
|
||||
|
||||
_enqueueOpenJDK(dataDir){
|
||||
_enqueueOpenJDK(dataDir, mcVersion){
|
||||
return new Promise((resolve, reject) => {
|
||||
JavaGuard._latestOpenJDK('8').then(verData => {
|
||||
const major = Util.mcVersionAtLeast('1.17', mcVersion) ? '17' : '8'
|
||||
JavaGuard._latestOpenJDK(major).then(verData => {
|
||||
if(verData != null){
|
||||
|
||||
dataDir = path.join(dataDir, 'runtime', 'x64')
|
||||
|
@ -10,6 +10,7 @@ const { MojangRestAPI, getServerStatus } = require('helios-core/mojang')
|
||||
// Internal Requirements
|
||||
const DiscordWrapper = require('./assets/js/discordwrapper')
|
||||
const ProcessBuilder = require('./assets/js/processbuilder')
|
||||
const { Util } = require('./assets/js/assetguard')
|
||||
const { RestResponseStatus, isDisplayableError } = require('helios-core/common')
|
||||
|
||||
// Launch Elements
|
||||
@ -317,6 +318,8 @@ function asyncSystemScan(mcVersion, launchAfter = true){
|
||||
sysAEx.stdio[2].on('data', (data) => {
|
||||
loggerSysAEx.log(data)
|
||||
})
|
||||
|
||||
const javaVer = Util.mcVersionAtLeast('1.17', mcVersion) ? '17' : '8'
|
||||
|
||||
sysAEx.on('message', (m) => {
|
||||
|
||||
@ -326,14 +329,14 @@ function asyncSystemScan(mcVersion, launchAfter = true){
|
||||
// Show this information to the user.
|
||||
setOverlayContent(
|
||||
'No Compatible<br>Java Installation Found',
|
||||
'In order to join WesterosCraft, you need a 64-bit installation of Java 8. Would you like us to install a copy?',
|
||||
`In order to join WesterosCraft, you need a 64-bit installation of Java ${javaVer}. Would you like us to install a copy?`,
|
||||
'Install Java',
|
||||
'Install Manually'
|
||||
)
|
||||
setOverlayHandler(() => {
|
||||
setLaunchDetails('Preparing Java Download..')
|
||||
sysAEx.send({task: 'changeContext', class: 'AssetGuard', args: [ConfigManager.getCommonDirectory(),ConfigManager.getJavaExecutable(ConfigManager.getSelectedServer())]})
|
||||
sysAEx.send({task: 'execute', function: '_enqueueOpenJDK', argsArr: [ConfigManager.getDataDirectory()]})
|
||||
sysAEx.send({task: 'execute', function: '_enqueueOpenJDK', argsArr: [ConfigManager.getDataDirectory(), mcVersion]})
|
||||
toggleOverlay(false)
|
||||
})
|
||||
setDismissHandler(() => {
|
||||
@ -341,7 +344,7 @@ function asyncSystemScan(mcVersion, launchAfter = true){
|
||||
//$('#overlayDismiss').toggle(false)
|
||||
setOverlayContent(
|
||||
'Java is Required<br>to Launch',
|
||||
'A valid x64 installation of Java 8 is required to launch.<br><br>Please refer to our <a href="https://github.com/dscalzi/HeliosLauncher/wiki/Java-Management#manually-installing-a-valid-version-of-java">Java Management Guide</a> for instructions on how to manually install Java.',
|
||||
`A valid x64 installation of Java ${javaVer} is required to launch.<br><br>Please refer to our <a href="https://github.com/dscalzi/HeliosLauncher/wiki/Java-Management#manually-installing-a-valid-version-of-java">Java Management Guide</a> for instructions on how to manually install Java.`,
|
||||
'I Understand',
|
||||
'Go Back'
|
||||
)
|
||||
|
@ -2,7 +2,7 @@
|
||||
const os = require('os')
|
||||
const semver = require('semver')
|
||||
|
||||
const { JavaGuard, Util } = require('./assets/js/assetguard')
|
||||
const { JavaGuard } = require('./assets/js/assetguard')
|
||||
const DropinModUtil = require('./assets/js/dropinmodutil')
|
||||
const { MSFT_OPCODE, MSFT_REPLY_TYPE, MSFT_ERROR } = require('./assets/js/ipcconstants')
|
||||
|
||||
@ -1156,6 +1156,7 @@ const settingsMemoryTotal = document.getElementById('settingsMemoryTotal')
|
||||
const settingsMemoryAvail = document.getElementById('settingsMemoryAvail')
|
||||
const settingsJavaExecDetails = document.getElementById('settingsJavaExecDetails')
|
||||
const settingsJavaReqDesc = document.getElementById('settingsJavaReqDesc')
|
||||
const settingsJvmOptsLink = document.getElementById('settingsJvmOptsLink')
|
||||
|
||||
// Store maximum memory values.
|
||||
const SETTINGS_MAX_MEMORY = ConfigManager.getAbsoluteMaxRAM()
|
||||
@ -1370,7 +1371,17 @@ function populateJavaReqDesc() {
|
||||
} else {
|
||||
settingsJavaReqDesc.innerHTML = 'Requires Java 8 x64.'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function populateJvmOptsLink() {
|
||||
const mcVer = DistroManager.getDistribution().getServer(ConfigManager.getSelectedServer()).getMinecraftVersion()
|
||||
if(Util.mcVersionAtLeast('1.17', mcVer)) {
|
||||
settingsJvmOptsLink.innerHTML = 'Available Options for Java 17 (HotSpot VM)'
|
||||
settingsJvmOptsLink.href = 'https://docs.oracle.com/en/java/javase/17/docs/specs/man/java.html#extra-options-for-java'
|
||||
} else {
|
||||
settingsJvmOptsLink.innerHTML = 'Available Options for Java 8 (HotSpot VM)'
|
||||
settingsJvmOptsLink.href = `https://docs.oracle.com/javase/8/docs/technotes/tools/${process.platform === 'win32' ? 'windows' : 'unix'}/java.html`
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1380,6 +1391,7 @@ function prepareJavaTab(){
|
||||
bindRangeSlider()
|
||||
populateMemoryStatus()
|
||||
populateJavaReqDesc()
|
||||
populateJvmOptsLink()
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -266,7 +266,7 @@
|
||||
</div>
|
||||
<input id="settingsJVMOptsVal" cValue="JVMOptions" serverDependent type="text">
|
||||
</div>
|
||||
<div id="settingsJVMOptsDesc">Options to be provided to the JVM at runtime. <em>-Xms</em> and <em>-Xmx</em> should not be included.<br><a href="https://docs.oracle.com/javase/8/docs/technotes/tools/<%= process.platform === 'win32' ? 'windows' : 'unix' %>/java.html">Available Options for Java 8</a>.</div>
|
||||
<div id="settingsJVMOptsDesc">Options to be provided to the JVM at runtime. <em>-Xms</em> and <em>-Xmx</em> should not be included.<br><a href="https://docs.oracle.com/javase/8/docs/technotes/tools/<%= process.platform === 'win32' ? 'windows' : 'unix' %>/java.html" id="settingsJvmOptsLink">Available Options for Java 8</a>.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="settingsTabLauncher" class="settingsTab" style="display: none;">
|
||||
|
Loading…
Reference in New Issue
Block a user