Sunday, December 14, 2014

How to create a Minecraft launcher on Mac OS X Yosemite with Java 8

Today, I will show you how to create your very own Minecraft launcher so that you don't get that annoying notice telling you to install Java SE 6.  This will also alleviate having to run Terminal commands to launch Minecraft.  You should be able to simply double click on the Minecraft and play!
A window informing you that in order to open Minecraft, you need to install the legacy Java SE 6 runtime.

Required files

To start, you will need to download the following:
1. Java SE Development Kit 8 - You will need to install the Java SE Development Kit 8 to be able to create the app bundle. Apache Ant and the Java Application Bundler will not run without it.

2. Apache Ant - Apache Another Neat Tool (ANT), is a software tool for automating software build process.  Don't worry, you will not be installing anything, it is simply a small tool that you unzip and run and you can throw it in the trash when you are done.

3. Java Application Bundler - Packages a Java application as a Mac app bundle.

4. Minecraft - Of course, you need to download Minecraft, but keep in mind that you do not need to download the Mac version. You will need to download the Minecraft.jar file. To do so, simply click on "Show all platforms", and under "Minecraft for Linux/Others", click on "Minecraft.jar".  Ok, ok, you are probably asking your self, "Wait a minute, something is not right." Don't fear, if you did not know, the Mac version of Minecraft is simply the same thing. What had happened is that they used an older version of Java to create a Mac app to launch Minecraft.  For some strange reason, they never updated it to Java 8. (Which boggles my mind because the current version of Minecraft is compatible with Java 8!) Well enough blabber, lets move on!
Now that you have all the necessary things, lets begin!

Putting it all together

1. Create a folder on your Desktop called Minecraft.

2. In the Minecraft folder, create a dist, and a lib folder.
3. In the lib folder, place the appbundler-1.0.jar file. In the dist folder place the Minecraft.jar file.
4. Unzip the apache-ant-1.9.4-bin.zip file and place the apache-ant-1.9.4 folder into your Minecraft folder.
5. Launch TextEdit and type the following (or copy and paste):

<?xml version="1.0" encoding="UTF-8"?>
<project name="Minecraft" default="default" basedir=".">
    <taskdef name="bundleapp"
        classname="com.oracle.appbundler.AppBundlerTask"
        classpath="lib/appbundler-1.0.jar" />
    <target name="bundle-Minecraft">
        <bundleapp outputdirectory="dist"
            name="Minecraft"
            displayname="Minecraft"
            identifier="Minecraft"
            mainclassname="net.minecraft.bootstrap.Bootstrap">
            <classpath file="dist/Minecraft.jar" />
        </bundleapp>
    </target>
</project>

6. In TextEdit, click on Format then click on Make Plain Text. Save the file into your Minecraft folder as build.xml and when prompted, click on Use .xml to save the file as an xml file.

7. Now the fun begins! On your Desktop click on Go menu and select Utilities.

8. In the Utilities folder, locate Terminal and launch it.

9. In the terminal we are first going to set up Ant. Do not worry, what we are going to do here is simply temporary, nothing is being modified on you system.  To set up Ant type the following:

export ANT_HOME="

Click and drag the apache-ant-1.9.4 folder right after the " so that you don't have to type out the file path, and remove the last space and type another " and press return on your keyboard.  So, your entry should look similar to the following:

export ANT_HOME="/Users/brilliant/Desktop/Minecraft/apache-ant-1.9.4"

(You might be wondering what this command does. Well, you are telling your Mac to temporarily remember the path to the apache-ant-1.9.4 folder as ANT_HOME.)

10. Now type in the following command and press return on your keyboard:

export PATH=$PATH:$ANT_HOME/bin

11.  Now, type the following command to go into your Minecraft folder:

cd Desktop/Minecraft

12.  And finally, type the following command to create your very own Minecraft launcher:

ant bundle-Minecraft

Now go into your Minecraft folder, then into the dist folder.  You will see your Minecraft app.

So, you are looking at your app and you see that you don't like the icon at all.  You can remedy that by doing the following:

1. Download the Mac version of Minecraft.
2. Open the Minecraft.dmg file.
3. Control-click (or right-click) on the Minecraft file and select Show Package Contents.
4. Go into the Contents folder and then into the Resources folder.
5. Now leave that window open and go back to your Minecraft app and Control-click (or right-click) on the Minecraft file and select Get Info.
6. Now left click and drag the favicon.icns and place it over the small icon on the Minecraft Info window to change the icon.  You will notice that a green + sign will show.

Now your app is complete!

No comments:

Post a Comment