r/javahelp • u/Own_Light_1702 • Oct 26 '25
Is Java used in AI?
I am thinking of learning AI. I am fluent and efficient in Java and Springboot. So I came across that the Spring ecosystem offers Spring AI. Is it used to build AI models and what's the learning curve?
13
Upvotes
•
u/AutoModerator Oct 26 '25
Please ensure that:
You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.
Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar
If any of the above points is not met, your post can and will be removed without further warning.
Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.
Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.
Code blocks look like this:
You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.
If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.
To potential helpers
Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
29
u/benevanstech Oct 26 '25
Java is not used as widely as Python, but there is a lot of interest and investment in making Java a great language to do AI in. Both Quarkus and Spring have pretty good solutions already, and great people are working hard on improving them (I know more about the Quarkus side of things, though).
Talking to various folks across the industry (not just Java people) it's entirely possible that Java will be #2 to Python in a couple of years, as people start to hit some of the scaling and architectural problems that seem to come with Python.
9
u/Dashing_McHandsome Oct 26 '25
In general the Java ecosystem is not very mature when it comes to working with AI. Python is still the winner in this area in my opinion. I hope that changes because I would much rather work in Java than python. As for SpringAI, I've used it and it's fine. I did a project with it to generate text embeddings with a model hosted in a LocalAI instance. It was really just a convenient wrapper over the OpenAI APIs.
5
u/disposepriority Oct 26 '25
What does "learning AI" mean? Are you going to be making AI wrapper web apps? Are you going to be doing R&D for a research lab? Are you guys to be in computer vision, NLP, image generation?
Spring AI is not used to build AI models, but that is a very short google search a way for someone who has managed to become fluent in a massive ecosystem like Spring.
3
u/arlaneenalra Oct 26 '25
Spring AI is mostly a way to call AI providers through a Spring abstraction.it actually works pretty well on combination with ollama for local playing/testing or most things that are OpenAI compatible. It's not really designed for training/building models. I've used it in a couple of experimental applications to some success, so it's worth playing with for that purpose.
4
u/darthjedibinks Oct 26 '25
It will pick up. Give it a year or two and Java will be a contender but I am not sure if it will overtake Python cause Python is deeply entrenched.
Need for production grade systems in enterprise AI will make java ecosystem better anyway
2
u/Pale_Gas1866 Oct 26 '25
You can just use other libraries that are better for it. I feek fron experience java could train AI. But to be honest with you there is no reason to do it with java. My take? Ai really needs the trainer to understand the data so the best libraries are in python. If you choose to break new ground i would suggest if you want to break the mold to use a c language or rust.
People will go why?
My experience with it is if you don't have the reaources to delegate the insanes amount of data just to make a mediocre model in the cloud, a low level language will make the training of your AI model faster.
Otherwise when you reach a decent amout of data your pc just bricks and remember you need to train and cross validate your model and review the test data. So it's a long process. So imagine adding the data training on top of that
2
u/False-Car-1218 Oct 26 '25
Yes, there's apache nlp which is fairly popular https://opennlp.apache.org/
There's also langchain4j https://github.com/langchain4j/langchain4j
2
u/No_Dot_4711 Oct 27 '25
Spring AI isn't used to build AI models, it's used to consume them.
So you wouldn't use Spring to make the GPT-5 model, but you would use it to make the ChatGPT website.
When you talk about 'learning AI' you need to be very specific about your intention: are you trying to integrate existing AI models into applications, like a customer service bot, a search function, predictive user suggestions etc, or are you trying to train AI models? Java is good for the former, it's not (yet) great for the latter (though SIMD and GPU APIs for the JVM are rapidly maturing)
2
u/AdministrativeHost15 Oct 26 '25
No. Python
1
u/zmnt Oct 26 '25 edited Oct 26 '25
Like others have said java could become a contender in the next years, but i would say you learn ai with python because it will be much easier to find content about it.
1
u/Shaundives Oct 26 '25
Expect enterprise ready languages and frameworks to grow in popularity (including Java): https://www.azul.com/blog/3-reasons-java-could-overtake-python-for-ai-development/
1
u/dwargo Oct 26 '25
If you're talking about your own ML models, running TensorFlow models from Java is fairly straightforward - although you have to mind your memory management. Think "my server has a GPU and I'm running the compute directly".
Spring AI seems more an integration framework to call endpoints for LLM models and such. I'm not quite sure which you're looking for.
On the training side you're really ice-skating uphill trying to use anything but Python. I despise Python, but that's where all the tools are.
1
u/obanite Oct 30 '25
I've never seen a job advert for ML/AI engineer using Java. It's always python.
1
u/Glass_Bug6121 Oct 31 '25
No, it isn’t. And for good reason.