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:
Fixing this error is very trivial. Right click the .jar file, and open properties.
Now in the properties menu, open the 'Permissions' tab. Enable the 'Allow executing this file as program' checkbox.
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.
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":
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!
Creator of It's FOSS. An ardent Linux user & open source promoter. Huge fan of classic detective mysteries ranging from Agatha Christie and Sherlock Holmes to Detective Columbo & Ellery Queen. Also a movie buff with a soft corner for film noir.
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