Skip to content

HowTo Start Environment

brayjamin edited this page Jul 13, 2021 · 15 revisions

Home | How To | How It Works | Samples | More

Index | Start Your Environment | Events | Write Code

Intro

Starting the Minecraft server is no different with Grakkit and GraalVM than it is for any other Java application. However we hope the detail here clarifies exactly how this works for those who are getting started.

Components

The components involved in starting your Minecraft server to use Grakkit are as follows:

Java Virtual Machine

Minecraft Server Executable

Grakkit Plugin

Entry Points

Java Virtual Machine

NOTES

  • We recommend using GraalVM, however Modern Grakkit can run on the standard Java VM
    Grakkit no longer benefits from using Graal externally, as as the components needed are packaged directly into the plugin!
  • For 1.17+ servers, remember to use Java 16 or newer! Compatibility will not break, as the Graal JVM/JDK is packaged with the plugin.

All Java programs run within a container called the Java Virtual Machine. This JVM is started by executing the 'java' program. That program usually comes from from Oracle, but as noted in HowItWorks, the Java/JavaScript integration used in Grakkit comes from the JVM provided in GraalVM.

Minecraft Server Executable

  • Grakkit supports all versions of Minecraft the Bukkit API implements!
  • You can find server builds for Paper (recommended) at Paper Downloads, and builds for bukkit/spigot at GetBukkit.

Minestom extension and Fabric mod versions of Grakkit have both been theorized, however we only support Bukkit servers currently.

Check out Other Implementations for alternatives to Grakkit and other information.

When first creating a server, it's important to ensure your server build and start script are in the same folder. This folder can be anywhere, hell, it could even be System32 (don't try this at home kids) but whatever the case may be, the README instructions will provide you with a good installation and start script that works from anywhere.

Please, for the love of (insert name here), don't actually install your server at System32 or any other system directory. It's best to put it in a convenient subfolder with read/write permissions.

Grakkit Plugin

Like all other plugins, Grakkit works as a .jar file in your server's plugins folder. Given the System32 example, this plugin would be located at C:\Windows\System32\plugins\grakkit-<version>.jar.

As the server starts, grakkit.jar is executed, and a folder called grakkit is created within the plugins folder, along with an index.js file. This is what makes up the bare necessities to the Grakkit Environment.

Entry Points

Generally, the term "Entry Point" refers to a file with access to the environment, and it's no different with Grakkit. Your main entry point into JS development will be index.js, a file within plugins/grakkit. Again, following the System32 example, this file and folder would be located within C:\Windows\System32\plugins\grakkit.

When the server starts, index.js is executed first.

More scripts can be executed by importing them into your index. Example:

/plugins/grakkit/coolPeople.js

const coolPeople = [ "john doe", "joe mama", "da baby" ];
module.exports = { people };

/plugins/grakkit/index.js

const coolPeople = require('./coolPeople.js');
let people = coolPeople.people;
people.join(", ");

console.log("Cool people: " + people);
// "Cool people: john doe, joe mama, da baby"