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,662 views

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 but ...READ MORE

May 16, 2019 in Java by Vicky

reopened 6 days ago by Neelam 660 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,770 points
2,304 views
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,770 points
769 views
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
2,681 views
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
951 views
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,350 points
1,341 views
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
1,266 views
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,240 points
1,180 views
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
1,019 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP