So I've tried almost everything but when I click on the jar file it opens the archive manager. There is no option to run it with java.
3 Answers
Running jars in linux is easy. Just open a terminal and type java -jar <path to jarfile> then hit enter and voilĂ it works.
- 2,214
I don't know why you tried to click on it, the location of the .jar file should be in the $PATH of minecraft. I don't have any experience mindcrafting, I have alot of experience programming in Java and administering Java dependant applications on Ubuntu; I also set my brother up with Gary's mod on Ubuntu 12.04.
So basically here's the diagnostic flowchart you want to follow when you are foo-bar:
1) Do you have a java virtual machine (JVM) installed (I used Oracle jdk7u26 I believe on that mod)? You can check by running the following command from command line:
:~$ java -version
2) Is the $PATH to the jre set ($JRE_HOME), either in your local startup script, the global startup script /etc/profile, or did your update the alternatives to give a symlink to /usr/bin/java, /usr/bin/jar? You can check by running the following commands:
:~$ echo $JRE_HOME
:~$ echo $JAVA_HOME
3) Is the location of the .jar in the $PATH of the mincraft executable? In the possibility your using a mod.
4) Whats the permissions of the .jar file you want to run?
:~$ stat thisminecraft.jar
Also you have symlink for the jar and for java cause you updated /etc/alternatives, you can create a bash script, and add the script to a docking application like cairo-dock:
#! /bin/bash
RNJAR="java -jar /home/youruser/MyBin/theminecraft.jar"
$RNJAR
exit
So create a directory like:
:~$ mkdir -p -m0755 $HOME/MyBin
Then copy the script above into gedit and save as
/home/youruser/MyBin/minecraft.sh
Change the mode of access to executable
:~$ chmod +x $HOME/MyBin/minecraft.sh
And you can create a custom launcher on cairo-dock or even put the script in the $HOME/Desktop (<- I never do this) folder as opposed to $HOME/MyBin.
Good Luck, and may the minecrafting be prosperous.
- 539
Java applications can have their own desktop or launcher icon to start like any other application.
To get there we just need to create a minecraft.desktop file in ~/.local/share/applications/ with the following content:
[Desktop Entry]
Encoding=UTF-8
Value=1.0
Type=Application
Name=MineCraft
GenericName=Minecraft
Comment=Start Minecraft
Icon=/home/<user>/.icons/minecraft.png ## choose any Icon you like
Exec=java -jar /full/path/to/minecraft.jar
Categories=Games
Path=/home/<user>/.minecraft/
Create or download any icon you like it to display and store it in ~/.icons. The desktop file needs to have executable permission (right click Properties, Permissions, tick Allow executing file as program).
- 144,580