-
Notifications
You must be signed in to change notification settings - Fork 0
Java
You can use Java to manually download Java. However, you can also use Launcher to automatically download Java.
const { Java } = require('eml-lib')
java()
async function java() {
const java = new Java(null, 'goldfrite', 'https://admintool.electron-minecraft-launcher.com')
try {
await java.download()
} catch (error) {
console.error(error)
}
}
Parameter | Type | Description | Required? |
---|---|---|---|
minecraftVersion |
string |
The version of Minecraft you want to install Java for. Set to null to get the version from the EML AdminTool. Set to latest_release to get the latest release version of Minecraft. Set to latest_snapshot to get the latest snapshot version of Minecraft. |
No (default is null ) |
serverId |
string |
Your Minecraft server ID (eg. 'minecraft' ). This will be used to create the server folder (eg. .minecraft ). Java will be installed in the runtime/jre-X folder, where X is the major version of Java. If you don't want to install Java in the game folder, you must install Java by yourself. |
Yes |
url |
string |
The URL of the EML AdminTool website, to get the version from the EML AdminTool. | No |
Get the files of the Java version to download.
Warning
You should not use this method directly. Use Java.download()
instead.
Parameter | Type | Description | Required? |
---|---|---|---|
manifest |
string |
The manifest of the Minecraft version. If not provided, the manifest will be fetched. | No |
Returns: Promise<File[]>
- The Java files to download.
Throws: FETCH_ERROR
- If the request to get the files fails.
Download Java for the Minecraft version.
Throws: FETCH_ERROR
- If the request to get the files fails. • DOWNLOAD_ERROR
- If an error occurs while downloading Java.
Emits: download_progress
- Java is downloading. • download_error
- Error while downloading Java. • download_end
- Java is downloaded. • java_info
- The Java version and architecture.
Check if Java is correctly installed.
Parameter | Type | Description | Required? |
---|---|---|---|
absolutePath |
string |
Absolute path to the Java executable. You can use ${X} to replace it with the major version of Java. |
No (default is GAME FOLDER/runtime/jre-${X} ) |
majorVersion |
number |
Major version of Java to check. | No (default is 8 ) |
Returns: { version: string; arch: "64-bit" | "32-bit" }
- The Java version and architecture.
Throws: JAVA_ERROR
- If Java is not correctly installed.