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

🌐
LinuxConfig
linuxconfig.org › home › how to run jar file on linux
Install Java JRE & Run JAR Files on Linux
September 21, 2025 - Learn how to install Java JRE on Linux and run JAR files seamlessly via GUI or command line. A step-by-step guide for all major distros.
🌐
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 - e-terminal 3a- java -jar file.jar , or 3b- install binfmt-support, then ./file.jar I tried java -jar file.jar but it didn't work I tried binfmt-support and then ./file.jar but it didn't work, it says "Impossible to execute the binary file" ... Hi Fox2240, Welcome to the wonderful world of Linux Mint and its excellent forum! I just read your post and the good replies to it. Here are my thoughts on this as well. It would help to know more about your system setup. If you run "inxi -Fxzd" and "lsusb" from the console terminal prompt, highlight the results, copy and paste them back here, that should provide enough information.
🌐
It's FOSS
itsfoss.com › run-jar-file-ubuntu-linux
How to Run Jar File in Ubuntu Linux
July 6, 2023 - And in this tutorial, I will walk you through how you can install its prerequisites and run Jar files in Ubuntu and other Linux with multiple methods.
🌐
TheServerSide
theserverside.com › blog › Coffee-Talk-Java-News-Stories-and-Opinions › Run-JAR-file-example-windows-linux-ubuntu
How to run a Jar file
The JAR file distributor wants you to specify the main-class on the command line. If you know the Java class that should act as the entry point of a runnable JAR, you can explicitly specify that file at the command line as follows:
🌐
FOSS Linux
fosslinux.com › home › linux distributions › debian & ubuntu › ubuntu › how to run jar files and services on ubuntu (2026 guide)
How to Run JAR Files and Services on Ubuntu (2026 Guide)
April 24, 2026 - How can I pass arguments to my JAR file? You can append arguments to the end of the command in your ExecStart line. For example: ExecStart=/usr/bin/java -jar my-app.jar --server.port=8081 · Running a JAR file on Ubuntu is a core skill for any developer or sysadmin.
Find elsewhere
🌐
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 - Let's move them into one jar file called "allClasses.jar". Run the command: jar --create --file allClasses.jar Class1.class Class2.class Class3.class · To get a clear output use --verbose · jar --create --verbose --file allClasses.jar Class1.class Class2.class Class3.class ·
🌐
Linux Today
linuxtoday.com › home › developer
How to Run Jar Files in Ubuntu
August 26, 2024 - Running a JAR (Java Archive) file on Ubuntu is quite straightforward. This guide shows how to run a JAR file on your Ubuntu system.
🌐
UbuntuMint
ubuntumint.com › home › uncategorized › how to run jar files in ubuntu
How to Run [Execute] Jar Files on Ubuntu
May 18, 2024 - Once installed, verify the version of the Java Runtime Environment (JRE) installed on your system. ... Once you have Java installed, you can download any sample JAR file, set the executable permission, and use the java command to run the JAR files as shown:
🌐
Reddit
reddit.com › r/archlinux › what is the correct way to run a jar
r/archlinux on Reddit: What is the correct way to run a jar
July 6, 2024 -

I made a jar executable. Im wondering how to run it from anywhere as a normal command?

I figured that i could create an alias to

java -jar /path/of/the/jar

but it does not seems right. I feel like it would make more sense to do something like adding it to the environment variable path or something like that.

What is the right way to do so? I basically want my command to work as ls, cd or cat does. I think...

🌐
TecMint
tecmint.com › home › linux commands › how to create and execute a .jar file in linux terminal
How to Create and Execute a .Jar File in Linux Terminal
July 14, 2023 - In this article, we will show how to create a Java application and bundle it into a JAR file and demonstrate how to execute a .jar file from the Linux terminal.
🌐
Coderanch
coderanch.com › t › 110909 › os › Running-jar-files-linux
Running jar files on linux (GNU/Linux forum at Coderanch)
Linux (and any Unix) does not have the concept of "file extension associations" in the way Windows does. Suggest you write a shell script that executes the correct 'java -jar xxx' command, and click that.
🌐
Coderwall
coderwall.com › p › ssuaxa › how-to-make-a-jar-file-linux-executable
How to make a JAR file Linux executable (Example)
August 30, 2023 - Read more about this here: http://www.linuxjournal.com/content/add-binary-payload-your-shell-scripts · Taking advantage of this possibility the trick is just to embed a runnable jar file into a Bash script file.
🌐
idroot
idroot.us › home › how to run jar files in linux
How to Run Jar Files in Linux - idroot
March 26, 2025 - OpenJDK is the open-source implementation commonly used in Linux, while Oracle Java is an alternative that might be required for certain applications. The most common way to run JAR files in Linux is through the command line interface.
🌐
Talentelgia
talentelgia.com › home › software development › step-by-step guide to run a .jar file
Step-by-Step Guide to Run a .JAR File
April 20, 2026 - A .JAR file is a compressed package that stores Java code, resources, and metadata in a single archive, making it easy to run applications on Windows, Linux, or macOS using a simple command in the terminal, such as “java -JAR filename.JAR”. ...
🌐
Kevin Boone
kevinboone.me › execjava.html
Making a Java JAR file self-executing (on Linux) - Kevin Boone
Call this script header, for example. Now concatenate this script with the Java JAR file: ... Now you should be able to run the application just by running my_app, and you can copy this file (preserving the executable attribute, of course) to /usr/bin or some other location on the $PATH.
🌐
thelinuxvault
thelinuxvault.net › blog › how-to-run-jar-file-on-linux
How to Run a JAR File on Linux: A Comprehensive Guide
For JRE 17 (LTS version, recommended): ... terminal to refresh environment variables. To run a JAR file, use the java -jar command followed by the path to your JAR file:...