1

I use this command in the terminal to run the minecraft launcher with java 8:

/home/max/Java/jre1.8.0_25/bin/java -jar Minecraft.jar

I included the full java path because I installed it on /home as a normal user and i want to include it.

That command works, it opens the launcher with Java 8 but I want to make a bash file so I don't have to open the terminal. And, most important, I don't want the terminal to remain open when I click play in the Minecraft launcher and the game starts.

Now if i close manually the terminal when the game have started, the game is closed too.

αғsнιη
  • 35,660
  • I personally look forward to the advice you receive. It has been my impression that if a bash file began it, the terminal will remain open as long as the program is running. Were it not for that one condition, I could have answered this question myself. – gyropyge Dec 25 '14 at 05:12

4 Answers4

6

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!

  • Does ~ work directly in a launcher file? – muru Dec 28 '14 at 17:52
  • @muru It should. If not, simply replace it with /home/USER. – RPiAwesomeness Dec 28 '14 at 18:11
  • @muru Huh, I guess I've never had an issue with this. If that's truly what the standard is, I'll edit my answer. – RPiAwesomeness Dec 28 '14 at 18:16
  • It's a common enough question here (getting ~, $BLAH, etc, to work in launcher files). Here's the standard, if you need: http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables. In particular: "If an argument contains a reserved character the argument must be quoted." and "Reserved characters are ... tilde ("~")..." – muru Dec 28 '14 at 18:18
  • @muru Ah, thank you for pointing this out! I haven't done a whole lot with launcher files, so I didn't know. I've fixed it :D – RPiAwesomeness Dec 28 '14 at 18:19
2

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!

Jeremy
  • 216
2

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.

Sudheer
  • 5,113
  • 4
  • 24
  • 27
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.

αғsнιη
  • 35,660