Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm trying to get the minecraft.jar file to execute , but the check box won't come up when I go to Properties > Permissions. I don't know much about the terminal and its commands so if someone could post a simple step by step solution on how to mark it that would be great. People keep saying to use a chmod command but I have no idea what that is, so you are forewarned if I say "over my head".

share|improve this question
    
jars don't need to be executable. you can launch them with an interpreter just like python and have a launcher script (which I think is the generally accepted practice). –  hbdgaf Sep 19 '13 at 0:13
1  
Have you tried right clicking the jar, and selecting "Open With > OpenJDK (or whatever java)"? –  Richard Sep 19 '13 at 0:13
add comment

4 Answers 4

up vote 1 down vote accepted

Assuming the file in question is in your $HOME (just move it with the GUI otherwise), open a terminal (that much should be easy :) then run this command:

chmod a+x jarfile.jar

Change jarfile.jar to the actual name of the file in question of course. If that gives you an error, the file is probably not owned by your user, so try again with sudo:

sudo chmod a+x jarfile.jar
share|improve this answer
    
Files in your home directory should not be owned by root –  minerz029 Sep 19 '13 at 0:13
    
THANK YOU SOOOO MUCH!!! –  Ben Sep 19 '13 at 0:16
    
It worked perfectly! –  Ben Sep 19 '13 at 0:17
    
@terdon thank you sooo much! –  Ben Sep 19 '13 at 0:19
    
@terdon Iknow it says I have to wait 5 minuets –  Ben Sep 19 '13 at 0:20
show 4 more comments

Jar files are supposed to be executed like below (assume you have configured JRE/JDK int he execution search path):

java -jar /path/to/jarfile.jar

You CANNOT directly execute a JAR file it even if you add the execute bit. Simply bash is not able to understand it.

A simple shell script will be ideal to run Minecraft, example

#!/bin/bash
java -Xms1024M -Xmx1024M -jar /path/to/mincraft.jar
share|improve this answer
    
You are able to mark it as executable then open it with a double click. You just need to associate the MIME type with Java JRE –  minerz029 Sep 19 '13 at 0:17
    
This is desktop environment specific, not flexible if JVM arguments need to be passed;-) But you are right anyway, double click executes jar files in DE/WM. –  Terry Wang Sep 19 '13 at 0:21
    
WHat about self-extracting jar files? –  terdon Sep 19 '13 at 0:21
add comment

Open a terminal with Ctrl+Alt+T, then type

chmod +x /path/to/jar_file.jar

If the check doesn't come up, it might be on a Windows filesystem, which wont work

share|improve this answer
    
I have had it work on 12.04 before but not this time so I don't know what to do. –  Ben Sep 19 '13 at 0:13
    
@Ben Is it on your system drive or a external disk? –  minerz029 Sep 19 '13 at 0:14
add comment
  1. Simply press CTRL+ALT+T
  2. type:

    java -Xms1024M -Xmx1024M -jar (copy and paste path to minecraft.jar)/Minecraft.jar
    
  3. Enjoy

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.