Java + LLMs: A hands-on guide to building LLM Apps in Java with Jakarta

Posted by Shaaf's blog on Tuesday, February 4, 2025

Java is an amazing language to work with. Millions of developers use it for daily work routines, and many mission-critical applications run on Java today. Whether we talk about banks, stock exchanges, or space, Java is prevalent and a language of choice.

With the advent of Large Language Models(LLM), new opportunities are at play. While Python has been the dominating language runtime for apparent reasons, there is a misconception that creating applications, agents, or other components for LLMs should also be done in Python. Most of the integration in LLMs is achieved by using REST API. Java is not short on anything in that space. System integration has been pretty awesome in Java, with many tools in that space. So why not Java?

LangChain4J! The amazing developers and contributors have provided many goodies for us to infuse LLMs into our apps. Use LangChain4J if you haven’t done so yet.

I had the opportunity to speak with A N M Bazlur about this topic at the JChampionsConf last week.

The source code and step-by-step guide is available here on github. And the speakerdeck.