The . syntax can only be used to run (by "sourcing") shell scripts.

You'll need to use the java command to run a .jar file:

java -jar Minecraft.jar

If you don't have java installed, you can fix that by installing the default-jre¹ package. You can see if you already have java installed by running in a terminal:

java -version 

[1]: This will install the default openjdk Java runtime. You can use openjdk-8-jre, or openjdk-7-jre, or openjdk-6-jre instead, if you prefer - whichever is available on your version of Ubuntu.

Answer from Jeremy Kerr on askubuntu.com
Top answer
1 of 9
314

The . syntax can only be used to run (by "sourcing") shell scripts.

You'll need to use the java command to run a .jar file:

java -jar Minecraft.jar

If you don't have java installed, you can fix that by installing the default-jre¹ package. You can see if you already have java installed by running in a terminal:

java -version 

[1]: This will install the default openjdk Java runtime. You can use openjdk-8-jre, or openjdk-7-jre, or openjdk-6-jre instead, if you prefer - whichever is available on your version of Ubuntu.

2 of 9
46

Linux is perfectly capable of running a foreign binary, like a JAR file. This is how Wine works, for example. To run JAR files as executable first make sure you have Java installed, then do the following in a console:

  1. Install binfmt-support Support for extra binary formats:

    The binfmt_misc kernel module, contained in versions 2.1.43 and later of the Linux kernel, allows system administrators to register interpreters for various binary formats based on a magic number or their file extension, and cause the appropriate interpreter to be invoked whenever a matching file is executed. Think of it as a more flexible version of the #! executable interpreter mechanism.

    sudo apt-get install binfmt-support
    
  2. cd to your JAR file and change it to executable (you can also do this through file properties in Nautilus)

    chmod a+rx myjar.jar
    
  3. Run your jar file just as if it was any other binary executable or shell script

    ./myjar.jar
    

Note: Be sure you have binfmt_misc Linux kernel module loaded. If you use your custom compiled kernel without this module, binfmt-support won't work.

🌐
Reddit
reddit.com › r/linux4noobs › how do i run .jar programs on linux in general?
r/linux4noobs on Reddit: How do I run .jar programs on linux in general?
November 29, 2024 -

I run gentoo, and have installed a dual boot of debian 12 to confirm that just installing java, jre, and openjdk does in fact not allow me to run .jar programs.

I am trying to install fabric to minecraft so I can add some mods to minecraft I want. Except that even with the software from here: https://wiki.gentoo.org/wiki/Java

and from here: https://packages.gentoo.org/packages/dev-java/openjdk

does not give me any program to open my fabric installer jar program to install it with. I have set the jar as a executable, but it still won't let me open it with any java programs. There are none.

Any help, even lazy help, is appreciated. Thank you for reading

FIX: you run them in terminal, which confused me since the tutorial I watched showed it as a program. Thanks for the help people. Haven't modded minecraft since I used windows

Discussions

Running .jar File on Linux - Stack Overflow
I used the instructions here: https://askubuntu.com/questions/192914/how-run-a-jar-file-with-a-double-click to set up my .jar file to run on a simple double-click, but as of right now, it does nothing when double-clicked. My guess is that the above line of code does not translate well to Linux. More on stackoverflow.com
🌐 stackoverflow.com
How do I run Jar files on linux - Oracle Forums
Java2 version is j2re-1.4.2_03 Distro RedHat Linux 9.0 /etc/profile.d/java.sh export PATH=$PATH:/usr/java/j2re1.4.2_03/bin which java /usr/java/j2re1.4.2_03/bin rpm -qa|grep -i java gcc-java-3.2.2-... More on forums.oracle.com
🌐 forums.oracle.com
March 11, 2004
What is the correct way to run a jar
One option is to register a binfmt_misc handler for java, which would let you run it directly (so long as you chmod it to be executable). This basically registers the java header as a runnable executable type with an associated handler, so exec will launch it using java when invoked. Here's instructions for that for java. More on reddit.com
🌐 r/archlinux
4
16
July 6, 2024
How can I run a .jar file through the Linux beta?
Thanks to everyone who helped me. I had the jar file in a folder and that’s why it wasn’t letting me access it. I got it thanks for the help. More on reddit.com
🌐 r/Crostini
11
8
April 17, 2019
🌐
Linux Mint Forums
forums.linuxmint.com › board index › main edition support › beginner questions
[SOLVED] How to run a .jar file - Linux Mint Forums
September 10, 2020 - What Java software are you trying to run? You must have a Java runtime installed. You must also run the command in the folder where the java .jar file is or create a new desktop shorrtcut launcher to that file using "java -jar " in front of the location path and filename
🌐
TheServerSide
theserverside.com › blog › Coffee-Talk-Java-News-Stories-and-Opinions › Run-JAR-file-example-windows-linux-ubuntu
How to run a Jar file
How do you run a JAR file on Windows, Mac or Linux? Double click the JAR? Run the JAR at the command line? Several approaches will work if you have Java or the JDK installed.
🌐
LinuxConfig
linuxconfig.org › home › how to run jar file on linux
How to run JAR file on Linux
September 21, 2025 - Usually, the JRE package is not installed on most Linux distros by default, so we must first install Java, and then we can open the JAR file(s). In this tutorial, we will show you how to install the Java Runtime Environment on all major linux distros. This will allow you to open JAR files regardless of what Linux distribution you are using.
🌐
GeeksforGeeks
geeksforgeeks.org › java › creating-and-executing-a-jar-file-in-linux-terminal
Creating and Executing a .jar File in Linux Terminal - GeeksforGeeks
July 6, 2021 - This will create an allClasses.jar file in the folder. Let's understand the above command thoroughly. --create: It is an option to create a jar file.
Find elsewhere
🌐
Coderanch
coderanch.com › t › 110909 › os › Running-jar-files-linux
Running jar files on linux (GNU/Linux forum at Coderanch)
... Depends on the Linux desktop you're using. It's just a matter of adding a file association so that ${JAVA_HOME}/bin/java is used to launch jar files with the proper command-line arguments -- but the details of doing so are distro- and/or desktop- specific.
🌐
Codemia
codemia.io › knowledge-hub › path › how_to_run_a_jar_file
How to run a JAR file
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises
🌐
Mahdi Hazaveh
hazaveh.net › home › how to open a jar file/application in linux
How to open a jar file/application in Linux - Mahdi Hazaveh
August 22, 2013 - Jar file is like a stand alone ... permission problem. the safest way to run a jar application on a Linux machine is to use terminal ......
🌐
Kevin Boone
kevinboone.me › execjava.html
Kevin Boone: Making a Java JAR file self-executing (on Linux)
It's just a matter of packing all the compiled class files, along with some meta-data, into a Zipfile, and calling it 'something.jar'. Then you can execute the self-contained JAR at the prompt like this: ... That's fine, so long as you can find (and remember) a suitable location to install ...
🌐
Oracle
forums.oracle.com › ords › apexds › post › how-do-i-run-jar-files-on-linux-3342
How do I run Jar files on linux - Oracle Forums
March 11, 2004 - Java2 version is j2re-1.4.2_03 Distro RedHat Linux 9.0 /etc/profile.d/java.sh export PATH=$PATH:/usr/java/j2re1.4.2_03/bin which java /usr/java/j2re1.4.2_03/bin rpm -qa|grep -i java gcc-java-3.2.2-...
🌐
Scribd
scribd.com › document › 530086900 › How-to-Create-and-Execute-a-Jar-File-in-Linux-Terminal
Create and Run JAR Files in Linux | PDF
August 23, 2018 - JavaScript is disabled in your browser · Please enable JavaScript to proceed · A required part of this site couldn’t load. This may be due to a browser extension, network issues, or browser settings. Please check your connection, disable any ad blockers, or try using a different browser
🌐
FOSTips
fostips.com › blog › linux › how to run .jar file in ubuntu 22.04 | linux mint 21[beginner’s guide]
How to Run .jar File in Ubuntu 22.04 | Linux Mint 21[Beginner's Guide] - FOSTips
January 27, 2023 - In pop-up terminal dialog, run command to open the .jar file (launch the java app or installer): ... In case you didn’t set Oracle Java as default Java in your Linux.
🌐
curl
curl.se › docs › manpage.html
curl - How To Use
Bug Report Code of conduct Dependencies Donate FAQ Features Governance History Install Known Bugs Known Risks Logo TODO website Info ... Bottom right handle resizes. --abstract-unix-socket --alt-svc --anyauth -a, --append --aws-sigv4 --basic --ca-native --cacert --capath --cert-status --cert-type -E, --cert --ciphers --compressed-ssh --compressed -K, --config --connect-timeout --connect-to -C, --continue-at -c, --cookie-jar -b, --cookie --create-dirs --create-file-mode --crlf --crlfile --curves --data-ascii --data-binary --data-raw --data-urlencode -d, --data --delegation --digest --disable-ep