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 in Java by Anvi
• 10,310 points
44 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 by Pratibha
• 2,740 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 in Java by Vicky

closed May 16 by Vardhan 20 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
86 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,540 points
47 views
+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 in Java by Jim
• 810 points

reshown Jun 17 by Vardhan 12,958 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,040 points
73 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
• 37,320 points
50 views
0 votes
1 answer

Install postgreSQL on Ubuntu

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

answered Mar 22 in Database by Nitesh
28 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
65 views
0 votes
1 answer

Need help with Java Installation

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

answered Feb 27 in Java by Pratibha
• 2,740 points
41 views