Issue
I'm new to Spring Boot and I'm trying to develop an application to later deploy it on AWS beanstalk. I started the project using java 11 but later I discovered that AWS only support java 8. Is it possible to set 'maven.compiler.target' in pom.xml to 1.8 to make it running correctly? Should I have to use Java 1.8 for both development and compile? I would like to use new Java features and library. I would like to have some opinion if someone have same problems. Thanks. Cd
Solution
You can install java 11 on your instances using ebextensions. Just create a folder .ebextensions in your source bundle and add there one file with following name 10_java.config and content:
[UPDATE: fixed formatting of the yaml file]
container_commands:
100-remove-old-java:
command: "sudo yum remove -y java-1.8.0-openjdk-headless"
200-download-rpm-package:
command: "wget https://d3pxv6yz143wms.cloudfront.net/11.0.4.11.1/java-11-amazon-corretto-devel-11.0.4.11-1.x86_64.rpm "
300-install-java:
command: "sudo yum localinstall -y java-11-amazon-corretto-devel-11.0.4.11-1.x86_64.rpm"
This will remove default java 8 and install AWS' distribution of java 11.
Answered By - igor
Answer Checked By - Mildred Charles (JavaFixing Admin)