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,090 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 119 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
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,580 points
+1 vote
11 answers

How to send HTTP POST requests on Java?

How to invoke Thread dump analysis API? Invoking ...READ MORE

answered Jun 16, 2019 in Java by Jim
• 810 points

reshown Jun 17, 2019 by Vardhan 70,094 views
0 votes
1 answer

How to pad an integer with zeros on the left in Java?

Use java.lang.String.format() method. String.format("%05d", number ...READ MORE

answered May 31, 2018 in Java by Daisy
• 8,110 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
• 51,950 points
0 votes
1 answer

Install postgreSQL on Ubuntu

Installing PostgreSQL on Ubuntu is very simple, ...READ MORE

answered Mar 22, 2019 in Database by Nitesh
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
0 votes
1 answer

Need help with Java Installation

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

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