0

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.

  • Just a hint... java -jar "path to jar" + search for linux desktop shortcut...this way you will learn more, then if someone serves it to you on silver plate :) – RiddleMeThis Jun 13 '15 at 14:14
  • @MichalHagara I know how to launch it from the terminal. Is there a way to launch it from just double clicking it? – Darkar2045 Jun 13 '15 at 14:16
  • you can make it open in java, right click-open with ...search for java sdk or whatever java you have installed....or create desktop entry with Exec=java -jar 'path to jar' or use bash script – RiddleMeThis Jun 13 '15 at 14:25
  • @MichalHagara It won't let me use java runtime from the open with menu – Darkar2045 Jun 13 '15 at 14:29
  • In this case you should be able to use custom command...right click...open with...custom command...'java -jar' withou quotation marks...it should work – RiddleMeThis Jun 13 '15 at 14:35
  • @MichalHagara Where's that? I only see open with application. – Darkar2045 Jun 13 '15 at 14:38
  • click on open with other application... it looks like this in my case http://tinypic.com/r/2mextau/8 – RiddleMeThis Jun 13 '15 at 14:42
  • @MichalHagara I did select open with other application. And I can't view your picture. – Darkar2045 Jun 13 '15 at 14:43
  • I am using Ubuntu Mate, but I suppose that another flavours has this function as well – RiddleMeThis Jun 13 '15 at 14:44
  • @MichalHagara I am using ubuntu – Darkar2045 Jun 13 '15 at 14:44
  • please post picture of what you get when you click: open with other application... my image again: http://i.imgur.com/bbal1Ub.png?1 – RiddleMeThis Jun 13 '15 at 14:44
  • Nautilus doeasn't have this function by default from what I have understood http://askubuntu.com/questions/431703/how-to-add-open-with-custom-command-option-in-right-click-menu-of-nautilus, but it can be added – RiddleMeThis Jun 13 '15 at 14:50
  • Or ubuntu tweak should be capable of file asociating http://popularubuntuquestions.com/add-custom-command-in-the-open-with-dialog/ other solutions are there as well – RiddleMeThis Jun 13 '15 at 15:07

3 Answers3

1

Running jars in linux is easy. Just open a terminal and type java -jar <path to jarfile> then hit enter and voilà it works.

Wolfer
  • 2,174
0

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.

oOpSgEo
  • 539
0

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).

Takkat
  • 142,284