Guide On How To install Java in AWS EC2

Guide On How To install Java in AWS EC2

October 17, 2020 / Nirav Shah

Launch an EC2 Instance

Step 1

Login to AWS console and select Service


Step 2

Click on Launch instance


Step 3

Select the OS/AMI of the server (in our case we have selected Ubuntu)


Step 4

Choose the instance type & click on Next


Step 5

Configure instance details & click on Next


Step 6

Add Storage & click on Next


Step 7

Add tags (In our case, key: Name and value: Java-Program this will help to identify the instance) & click on Next


Step 8

Configure Security Group (Please make sure you have SSH port 22 open in the security group) & click on Next


Step 9

Review instance Launch & click on Launch


Step 10

Select an existing key pair or create a new key pair & Click on launch instance


If you are fairly new to AWS environment, you should know “how to launch an EC2 instance in AWS”.

Login to the server

Step 11

SSH into the server

	$ chmod 400 new_keypair.pem #if you have a new key pair
	$ ssh -i new_keypair.pem ubuntu@public_ip_address


Update and Upgrade the server

Step 12

By update and upgrading the server you will get the latest packages and versions to install in the server.

	$ sudo apt update && sudo apt upgrade -y


Install Java JRE

Step 13

install the default Java Runtime Environment (JRE), which will install the JRE from OpenJDK.

	$ sudo apt install default-jre


Install Java JDK

Step 14

You may need the Java Development Kit (JDK) in addition to the JRE in order to compile and run some specific Java-based software.

	$ sudo apt install default-jdk


Check the Java Version

Step 15

To verify that java has installed completely

	$ java -version



And it’s done. Since Java is already installed, you might want to know about how to install Jenkins in Ubuntu on an AWS server.

Hire AWS Experts

Talk to AWS Certified Consultant

    Spread Love By Sharing:

    Let’s Talk About Your Needed AWS Infrastructure Management Services

    Have queries about your project idea or concept? Please drop in your project details to discuss with our AWS Global Cloud Infrastructure service specialists and consultants.

    • Swift Hiring and Onboarding
    • Experienced and Trained AWS Team
    • Quality Consulting and Programming
    Let’s Connect and Discuss Your Project