diff --git a/app/assets/js/assetguard.js b/app/assets/js/assetguard.js index 57ece17d..dcfcd7fa 100644 --- a/app/assets/js/assetguard.js +++ b/app/assets/js/assetguard.js @@ -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') diff --git a/app/assets/js/scripts/landing.js b/app/assets/js/scripts/landing.js index fc60d92b..f423268d 100644 --- a/app/assets/js/scripts/landing.js +++ b/app/assets/js/scripts/landing.js @@ -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
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
to Launch', - 'A valid x64 installation of Java 8 is required to launch.

Please refer to our Java Management Guide for instructions on how to manually install Java.', + `A valid x64 installation of Java ${javaVer} is required to launch.

Please refer to our Java Management Guide for instructions on how to manually install Java.`, 'I Understand', 'Go Back' ) diff --git a/app/assets/js/scripts/settings.js b/app/assets/js/scripts/settings.js index 5c05a15c..a8cda8c5 100644 --- a/app/assets/js/scripts/settings.js +++ b/app/assets/js/scripts/settings.js @@ -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() } /** diff --git a/app/settings.ejs b/app/settings.ejs index 34274756..aa1fa764 100644 --- a/app/settings.ejs +++ b/app/settings.ejs @@ -266,7 +266,7 @@ -
Options to be provided to the JVM at runtime. -Xms and -Xmx should not be included.
Available Options for Java 8.
+
Options to be provided to the JVM at runtime. -Xms and -Xmx should not be included.
Available Options for Java 8.