How to install additional software and programs (such as Java) on lambda via serverless?

I’m working with a python package that requires java. Is it possible to install Java - or other software - inside lambda via serverless? It appears that AWS Chalice can do this, see [1], so I’m assuming it might be possible with serverless.

References

[1] How to install third-party command line software on AWS Lambda function using Python Chalice (2019). Available at: https://hicraigchen.medium.com/how-to-install-third-party-command-line-software-on-aws-lambda-function-using-python-chalice-9ca3a9860367 (Accessed: 28 May 2021).