October 17, 2020 / Nirav Shah
Login to AWS console and select Service

Click on Launch instance

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

Choose the instance type & click on Next

Configure instance details & click on Next

Add Storage & click on Next

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

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

Review instance Launch & click on Launch

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”.
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

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 the default Java Runtime Environment (JRE), which will install the JRE from OpenJDK.
$ sudo apt install default-jre

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

To verify that java has installed completely
$ java -version
Output

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.

Nirav Shah is the Director of Eternal Web Pvt Ltd, an AWS Advanced Consulting Partner and certified Odoo Partner based in the UK. With over a decade of experience in cloud computing, digital transformation, and ERP implementation, Nirav helps enterprises adopt the right technology to solve complex business challenges. He specialises in AWS infrastructure, Odoo ERP, and web development solutions for businesses across the UK and beyond.
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.