How to execute a .jar file from the terminal

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

java -jar {path_of_the_file}/{file_name}.jar

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:

java -version 

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,

sudo apt-get install default-jre

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:

sudo apt-get install default-jdk

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

Comments

comments

11 thoughts on “How to execute a .jar file from the terminal”

  1. I love reading through and I believe this website got some genuinely utilitarian stuff on it.

  2. I must say, as a lot as I enjoyed reading what you had to say, I couldnt help but lose interest after a while.

  3. Wonderful goods from you, man. I’ve understand your stuff previous to and you are just too fantastic.

  4. I used to be more than happy to seek out this internet-site.I needed to thanks for your time for this excellent learn!! I positively enjoying every little little bit of it and I have you bookmarked to check out new stuff you weblog post.

  5. This web site certainly has all of the information and
    facts I needed about this subject and didn’t know who to ask.

  6. After reading your post, you have a great website with interesting content. But I think you can improve your current google ranks by using SEO website traffic net. My friend uses it and it works great. Just google it, it’s very nice tool to bring you a lot of new readers on a daily basis. Keep up the quality work!

  7. Its such as you read my mind! You seem to understand a lot about this, such as you wrote the guide in it or something.
    I feel that you could do with some percent to drive
    the message home a bit, but instead of that, this is magnificent blog.

    A fantastic read. I will certainly be back.

  8. I have noticed you don’t monetize your website, don’t waste your traffic,
    you can earn additional bucks every month. You can use the best adsense alternative for any type
    of website (they approve all websites), for more details simply search in gooogle:
    boorfe’s tips monetize your website

Comments are closed.