This package has been deprecated

Author message:

Use @xmcl/installer

@xmcl/java-installer

0.1.4 • Public • Published

Installer Module

npm version Downloads Install size npm Build Status

Provide functions to install jaav from Minecraft source.

Usage

Install Java 8 From Mojang Source

Scan java installation path from the disk. (Require a lzma unpacker, like 7zip-bin or lzma-native)

    import { JavaInstaller } from "@xmcl/java-installer";

    // this require a unpackLZMA util to work
    // you can use `7zip-bin`
    // or `lzma-native` for this
    const unpackLZMA: (src: string, dest: string) => Promise<void>;

    await JavaInstaller.installJreFromMojang({
        destination: "your/java/home",
        unpackLZMA,
    });

Scan Local Java

This will scan the paths in arguments and some common places to install java in current os.

So passing an empty array is OK.

    import { JavaInstaller, JavaInfo } from "@xmcl/java-installer";

    const validJavaList: JavaInfo[] = await JavaInstaller.scanLocalJava([
        "my/java/home"
    ]);

    // it can parse java major version, like `8` or `10`
    const javaMajorVersion: number = validJavaList[0].majorVersion;

    // also the java version
    const javaVersion: string = validJavaList[0].version;

    // also contain the path
    const jPath: string = validJavaList[0].path;

Package Sidebar

Install

npm i @xmcl/java-installer

Weekly Downloads

11

Version

0.1.4

License

MIT

Unpacked Size

30.9 kB

Total Files

11

Last publish

Collaborators

  • ci010