How to transform a java application compiled with java13 to an aws lambda function

I’ve developed a simple java application compiled with java version 13, but as I know, aws lambda support only java 8 and java 11.

Is there any solution or workaround to adapt my application to java 11 without changing the application compiler version to 11 ?

Thank you

Answer

The simplest solution, assuming that you have not used language features or library methods that are not supported by Java 11, is to use the -source and -target options to tell the compiler to produce Java 11 compatible output. You don’t say what build tool you’re using, but it should provide some way to configure this (for example, Maven).

If you are using Java-13-specific features, I would make an effort to remove them, so that you can target Java 11.

But if that isn’t possible, then your only option is to deploy your Lambda using a Lambda container image. You won’t be able to use the provided base images, so you’ll need to learn how to build Docker images. And you’ll need to explicitly build the Lambda runtime API bootstrap for your image.