Create bash file to open minecraft launcher

Solution 1:

You can create a .desktop file that will do this. Bash file are usually run from the terminal, while .desktop files simply run a command, not necessarily needing a Terminal.

As for launching Minecraft, that's simple enough.

  1. Run nano ~/.local/share/applications/minecraft.desktop in Terminal

  2. Copy/paste this in to the file you just opened:

    [Desktop Entry]
    Comment="Launching Minecraft"
    Terminal=false
    Name=Minecraft Launcher
    Exec=/home/USER/Java/jre1.8.0_25/bin/java -jar ~/Minecraft.jar
    Type=Application
    Icon=/home/USER/.minecraft/mc_logo.png
    
  3. Save and close that file

  4. Save this image in your ~/.minecraft folder as mc_logo.png:

    logo

And you should be able to find this in the dash and launch Minecraft without the Terminal!

Solution 2:

If you are using linux you probably like to see different ways of "living". I suggest you the hard way:

  1. open a terminal (I can not survive with less than 3 terminals opened) and keep it opened! And learn how to do everything with commands.
  2. create a ~/bin directory for your commands (mkdir ~/bin)
  3. add ~/bin the PATH
  4. create a command named minecraft (using @Sudheer, using an editor or by

    echo -e '#!/bin/bash'
    /home/max/Java/jre1.8.0_25/bin/java -jar Minecraft.jar' > ~/bin/minecraft
    chmod 755 ~/bin/minecraft
    
  5. instead of clicking, just write minecraft in your terminal.

Solution 3:

Welcome to Ubuntu.

I am guessing you're using the latest version of Minecraft launcher(the new Minecraft launcher since Minecraft 1.6) with the title `Minecraft Launcher 1.5.3)right?

With the command you state above, it will only start Minecraft launcher with Java 8 instead of Minecraft(the game) with Java 8.

If you want to launch Minecraft with Java 8, launch Minecraft launcher as usual. Next, click on Edit Profile button. You will see a dialog. Under Java Settings (Advanced), tick the Executable checkbox and put in the path to Java 8. Click Save Profile and you're done!

@Ubuntu4Life, you are advised to always use latest version of Java. Mojang also advises everyone to use latest version of Java to play Minecraft for performance boosts and a lot!

Solution 4:

You can follow @RPI_Awesomeness and create a desktop icon it's easy to access from dash search. If you want to create a bash file then

  1. Create a empty document on your desktop and paste the whole command in it.

  2. Right click & goto properties make it executable.

That's it now double click and select run.