Tag Archives: package

How to execute a .jar file from the terminal

To execute .jar file, java command should be used as below:

And to execute above command, Java package must be installed on Ubuntu PC. To check if java package is already installed, execute below command in a terminal:

It should display current version of Java package installed.

If it¬†displays “The program java can be found in the following packages”, It means Java hasn’t been installed yet. Execute below command in a terminal to install java package,

This will install the Java Runtime Environment (JRE) only not Java Development Kit (JDK). If Java Development Kit (JDK) is needed, which is usually needed to compile Java applications, execute the following command in terminal:

That is everything to install Java. Now run first command to execute .jar file.