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
• 5,960 points
32 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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,520 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 15 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
48 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,520 points
41 views
0 votes
10 answers

How to send HTTP POST requests on Java?

You can use the function as HttpURLConnection.setRequestMethod( ...READ MORE

answered Dec 10, 2018 in Java by simplecode
9,527 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,020 points
47 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
• 35,880 points
36 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
16 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,200 points
51 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,520 points
30 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.