banner



How To Require An Ubuntu Java App To Run As Root

You are here: Home / Linux / How to Run Jar File in Ubuntu Linux

Got a Jar file but struggling to execute it? Learn how to run a Jar file in Ubuntu and other Linux distributions.

How to execute Jar file in Ubuntu and other distributions

A Jar file is basically a Java executable file. So you must have Java installed on your system. If you have Java installed in your Ubuntu, you should be able to run it either by double clicking or by selecting from right click options.

The problem here is that most Linux distributions don't come with Java pre-installed. So please make sure to install Java on Ubuntu. or whichever distribution you are using.

You only need the Java Runtime Environment and you can install it using the command below in Ubuntu-based distributions:

sudo apt install default-jre

Even with Java installed, sometimes running a Java application is not as straightforward as double-clicking the icon. You might have to go through a few steps.

When I tried to open the .jar file by double clicking, I was presented with the following error:

Ubuntu Run Java Jar Error
File not executable error

Fixing this error is very trivial. Right click the .jar file, and open properties.

Ubuntu Run Java Jar Menu
Right click on Jar file and click Properties

Now in the properties menu, open the 'Permissions' tab. Enable the 'Allow executing this file as program' checkbox.

Ubuntu Run Java Jar Permission Set
Enable Execution of the file under the Permissions tab

Now, you can simply double click the .jar file to launch the application, AndroMouse in my case. You can see that it works without any problems.

Ubuntu Run Java Jar App Running
Java App Running

You have to keep in mind that you have to enable the 'Allow executing as program' permission for every .jar application you download. It is disabled by default as a security measure. You should enable it only for the applications that you trust and know are safe.

Further troubleshooting Jar file not running on Linux

Even if you have Java Runtime Environment installed and execution permission set, in some older versions of Ubuntu, the Jar file won't run. Here's a fix for that.

Right click on the .jar file and choose the option "Open With Other Application":

Ubuntu Jar Files

Now on the next screen, select the option Show other applications:

In other applications, if you do not find option for Java, install the Java Runtime Environment first. Normally, you should be able to see the option Open With OpenJDK Java x Runtime. Select it and successfully run it.

Enjoy running Jar file on Ubuntu!

I hope this short guide was useful to all of you. Which Java based applications do you use? Do you have any other problems with them? Let me know in the comments below!


How To Require An Ubuntu Java App To Run As Root

Source: https://itsfoss.com/run-jar-file-ubuntu-linux/

Posted by: hunsuckermilitaidele1997.blogspot.com

0 Response to "How To Require An Ubuntu Java App To Run As Root"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel