B4J Question [RESOLVED I think] java version for AWS Lambda

JackKirk

Well-Known Member
Licensed User
Longtime User
Hi,

I'm after a bit of java knowledge that escapes me.

I would like to explore using AWS Lambda (https://docs.aws.amazon.com/lambda/latest/dg/welcome.html)

There seem to be a range of java runtimes that can be used (https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html) including:

Java 21
Java 17
Java 11
Java 8

The B4J installation notes essentially recommend Oracle Java 8 or OpenJDK 14 and I'm currently using OpenJDK 14.

How do these correlate, if at all, to the AWS Lambda runtimes?

Thanks in anticipation...
 

Daestrum

Expert
Licensed User
Longtime User
Looks like they just list the LTS versions of Java
 
Upvote 0

JackKirk

Well-Known Member
Licensed User
Longtime User
Last edited:
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
Also, it raises a question: when will B4X "support" (if that is the right word) later LTS java releases?
I currently use Java 22 & 21 - the IDE is quite happy using them. (The Java folder structure setup is the same as Java11) .
 
Upvote 0

JackKirk

Well-Known Member
Licensed User
Longtime User
I currently use Java 22 & 21 - the IDE is quite happy using them. (The Java folder structure setup is the same as Java11) .
Being the conservative bugger I am, I worry that there might be some hidden pothole - why is Erel only advocating Oracle Java 8 or OpenJDK 14?
 
Upvote 0

JackKirk

Well-Known Member
Licensed User
Longtime User
You can use a newer version of Java.
OpenJDK 19 is available here: https://www.b4x.com/android/forum/threads/jgooglemaps-library.56744/#content
Erel, sorry to be picky but AWS is saying

Java 21
Java 17
Java 11
Java 8

Which are apparently "long term support".

Questions:
  • Any idea if OpenJDK 19 could be used in lieu of (say) Java 17?
  • I see there are OpenJDK 17 and 21 releases available - are they "sanctioned" for use with B4X?
  • If an Oracle version is long term support does this mean that the corresponding OpenJDK version will also be?
Thanks...
 
Upvote 0

JackKirk

Well-Known Member
Licensed User
Longtime User
I subscribe to AWS paid support.

I opened a case:
There seem to be a range of java runtimes that can be used (https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html ) including:

Java 21
Java 17
Java 11
Java 8

I am told these are Oracle "long term support" releases.

Can I use the equivalent OpenJDK release?

Thanks...
The response was:
Hello,

Thank you for writing to us.

As you noted, it is true that AWS Lambda Java runtime framework reference Oracle and Amazon Corretto, as you can see at the following link under the section title "Language and framework support policies":

https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html#runtime-support-policy

Note from the link below that the official AWS Java SDK, also provided by Lambda Java runtime (as noted at [1]), supports OpenJDK and Amazon Corretto:

https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/setup-project-maven.html

We further note that "Amazon Corretto is a no-cost, multiplatform, production-ready distribution of Open Java Development Kit (OpenJDK) that comes with long-term support (LTS)." [2]

You should therefore be able to use OpenJDK alternative. However, may I kindly advise that due diligence is still required to ensure that your entire logic, including all dependencies, is tested and verified to run expectedly on the managed runtime.[3] Should there be incompatibilities with the managed runtime, then you can opt for custom runtime environment [4] in order to ensure that you control every aspect of the runtime environment. Do let me know however if there are any other queries I can help with.

1. https://docs.aws.amazon.com/lambda/latest/dg/lambda-java.html
2. https://aws.amazon.com/corretto/faqs/
3. https://docs.aws.amazon.com/lambda/latest/dg/testing-guide.html
4. https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html

We value your feedback. Please share your experience by rating this and other correspondences in the AWS Support Center. You can rate a correspondence by selecting the stars in the top right corner of the correspondence.

Best regards,
Keith C.
Amazon Web Services
My interpretation is that I should be able to use OpenJDK 17 or 21 as far as they are concerned.

Now to see if B4X does not hiccup...
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
My interpretation is that I should be able to use OpenJDK 17 or 21 as far as they are concerned.

Now to see if B4X does not hiccup...
If you are worried about it, you can always install the appropriate Amazon Corretto and use it for the B4J projects that involve targeting AWS Lambda Java. You can use the #JavaCompilerPath attribute (see https://www.b4x.com/android/forum/threads/b4j-v8-80-has-been-released-🍾.125536/#content) to tell your project to use Amazon Corretto instead of the JDK set up in the B4J IDE.
 
Upvote 0

JackKirk

Well-Known Member
Licensed User
Longtime User
If you are worried about it, you can always install the appropriate Amazon Corretto and use it for the B4J projects that involve targeting AWS Lambda Java. You can use the #JavaCompilerPath attribute (see https://www.b4x.com/android/forum/threads/b4j-v8-80-has-been-released-?.125536/#content) to tell your project to use Amazon Corretto instead of the JDK set up in the B4J IDE.
Thanks OliverA, for anyone interested this looks like the way to go:

https://aws.amazon.com/corretto/?fi...ds.createdDate&filtered-posts.sort-order=desc
 
Upvote 0
Top