Install Java on Ubuntu

0 votes
Can anyone please tell me how to install Java on Ubuntu using command-line? And which packages should I install to get JDK as well as JRE.
Mar 1, 2019 in Java by Anvi
• 14,150 points

1 answer to this question.

0 votes

Hi @Anvi, to install Java on Ubuntu, you just have to type-in some commands on your terminal and it will install the JDK and JRE whatever you wish to install. Please follow the steps to install Java:

1. To install the default JDK, firstly update the package repository:

>>sudo apt-get update
>>sudo apt-get install default-jdk

2. Now if you want to install the default JRE, use following command:

>>sudo apt-get install default-jre

3. To check the installed version, user following command:

>>javac -version
answered Mar 1, 2019 by Pratibha
• 3,690 points

Related Questions In Java

+1 vote
0 answers

How to install java on linux operating system?

I read good info about java here ...READ MORE

May 16, 2019 in Java by Vicky

closed May 16, 2019 by Vardhan 238 views
0 votes
1 answer

How to install Java 8 on Mac

Oracle has a poor record for making ...READ MORE

answered Dec 23, 2020 in Java by Gitika
• 65,950 points
0 votes
1 answer

How to install the JDK on Ubuntu Linux?

Open Terminal from Application Dash or press Ctrl+Alt+T Update repository: sudo add-apt-repository ...READ MORE

answered Dec 30, 2020 in Java by Gitika
• 65,950 points
0 votes
1 answer

Is it possible to run a java program from command line on windows?How?

  Let's say your file is in C:\myprogram\ Run ...READ MORE

answered Apr 18, 2018 in Java by sophia
• 1,400 points
0 votes
1 answer

Perform "Switch-case" on String in Java

Switches based on integers can be optimized ...READ MORE

answered May 8, 2018 in Java by Rishabh
• 3,620 points
0 votes
1 answer
0 votes
1 answer

Serverspec doesn't check package version correctly

Specinfra is escaping the characters in the with_version chain ...READ MORE

answered Aug 2, 2018 in DevOps Tools by Kalgi
• 52,370 points
0 votes
2 answers

Install postgreSQL on Ubuntu

Follow the below commands to install PostgreSQL (PSQL) ...READ MORE

answered Nov 12, 2020 in Database by Prachi
• 140 points
0 votes
1 answer

How do I set variable if a specific package version is installed in CFEngine?

Here is what you can do.Just use packagesmatching to ...READ MORE

answered Jul 12, 2018 in Other DevOps Questions by Atul
• 10,230 points
0 votes
1 answer

Need help with Java Installation

Hi @Ashmita, to asnwer your question, lets ...READ MORE

answered Feb 28, 2019 in Java by Pratibha
• 3,690 points