Skip to content

Configuring Self Update

sk89q edited this page Feb 21, 2015 · 40 revisions

The bootstrap program:

  1. Downloads the launcher from your website.
  2. Chooses a standard folder to store the launcher's files (in My Documents or the home folder).
  3. Updates the launcher automatically.

latest.json

One of the sample files is latest.json. In it, it contains a link to a pack-compressed version of the launcher for download, as well as the latest launcher version.

The file looks like:

{
    "version": "4.0.1",
    "url": "http://example.com/versions/4.0.1.jar.pack"
}

The version should correspond to the version in build.gradle (in the source code). Change "4.0.1" to whatever version is in build.gradle at the moment.

Creating the .jar.pack

Take the launcher file and run it through the pack200 tool that comes with the JDK. Upload this to the website and also change the URL in latest.json (also on your site).

pack200 --no-gzip launcher.jar.pack launcher-X.Y.Z-all.jar

(That command makes launcher.jar.pack from launcher-X.Y.Z-all.jar in the same folder.)

Customizing the Bootstrapper

Inside the folder launcher-bootstrap/src/main/resources/com/skcraft/launcher/ will be:

  • lang/, which contains language files you should change
  • bootstrap.properties, which contain important settings you must change
  • bootstrapper_icon.png, which is the bootstrapper icon

Bootstrap Resources

The properties file is one of the most important. It looks like:

homeFolderWindows=Example Launcher
homeFolder=.examplelauncher
launcherClass=com.skcraft.launcher.Launcher
latestUrl=http://example.com/latest.json
  • "homeFolderWindows" is the folder in "My Documents" (i.e. C:\Users\Name\Documents\Example Launcher)
  • "homeFolder" is the folder in the user's home folder (i.e. /home/.examplelauncher)
  • "launcherClass" does not need to be changed unless you are using the Fancy Launcher
  • "latestUrl" should point to latest.json on your website

Recompiling

  1. Recompile the entire launcher again (using gradlew clean build).
  2. Double click the -all.jar file in launcher-bootstrap/build/libs to make sure it works.
  3. Check your home folder (BSD/Linux/Mac OS X users) or My Documents (Windows users) to see the folder name that you used.

My Documents

If everything works, you are done! Give players a copy of the bootstrapper -all.jar file.

Tip: Use something like launch4j to make an .exe file for Windows users.

Pushing Launcher Updates

Whenever you want to push an update:

  1. Update the version in build.gradle (NOTE: Unlike the versions for modpacks, this version should actually be a proper version like #.#.# or #.#, or #).
  2. Recompile the launcher.
  3. Upload the pack-compressed version of your .jar.
  4. Update the version number and URL in latest.json.

You never should need to update the bootstrapper.

Clone this wiki locally