I dug the internet a lot and found the solution.

One can do this using the following commands:

String fetching = "python " + "c:\\Fetch.py \"" + songDetails + "\"";
String[] commandToExecute = new String[]{"cmd.exe", "/c", fetching};
Runtime.getRuntime().exec(commandToExecute);
Answer from metamemelord on Stack Overflow
🌐
Reddit
reddit.com › r/python › pyspring - a python web framework inspired by spring boot.
r/Python on Reddit: PySpring - A Python web framework inspired by Spring Boot.
June 15, 2025 -

I've been working on something exciting - PySpring, a Python web framework that brings Spring Boot's elegance to Python. If you're tired of writing boilerplate code and want a more structured approach to web development, this might interest you!

- What's cool about it:

  • Auto dependency injection (no more manual wiring!)

  • Auto configuration management

  • Built on FastAPI for high performance

  • Component-based architecture

  • Familiar Spring Boot-like patterns

    • Recent PRs:

      • Route Mapping Decorators Implementation #3

      • Add Support for Qualifiers and Component Registration Validation

  • GitHub: https://github.com/PythonSpring/pyspring-core

  • Example Project: https://github.com/NFUChen/PySpring-Example-Project

Note: This project is in active development. I'm working on new features and improvements regularly. Your feedback and contributions would be incredibly valuable at this stage!If you like the idea of bringing Spring Boot's elegant patterns to Python or believe in making web development more structured and maintainable, I'd really appreciate if you could:

  • Star the repository

  • Share this with your network

  • Give it a try in your next project

Every star and share helps this project grow and reach more developers who might benefit from it. Thanks for your support! 🙏I'm actively maintaining this and would love your feedback! Feel free to star, open issues, or contribute. Let me know what you think!

🌐
Medium
medium.com › @kiarash.shamaii › integrating-a-simple-python-model-with-a-spring-boot-application-ddaf372831a7
Integrating a Simple Python Model with a Spring Boot Application | by kiarash shamaii | Medium
September 1, 2024 - The Spring Boot application will expose an API that calls the Python model to make predictions. ... A Python model definition file.
Discussions

java - Running a Python script from Spring-Boot Web Application on embedded Tomcat - Stack Overflow
Note: Both, Spring-Boot Project and Python Script, are working standalone without issues. More on stackoverflow.com
🌐 stackoverflow.com
java - How to call a python program from spring boot? - Stack Overflow
I am using implicit library in python to implement a recommendation system. The model is ready, but the problem is my application is java based(spring boot). Now I've the model, matrices and everyt... More on stackoverflow.com
🌐 stackoverflow.com
Execute Python script from Spring boot
If you specifically want to execute python code and other solutions doesn't work for you then you can create a service using django or flask or any other python backend framework with a rest endpoint. Then call the rest endpoint from your Spring Boot server using WebClient or RestTemplate. More on reddit.com
🌐 r/SpringBoot
4
2
November 29, 2023
Spring Boot and Python machine learning
Recently we introduced python flask api in our spring boot world. We wanted to utilize some ML AI stuff and it was easier to achieve what we need using python. We tried using Spring AI, but it is not even close to what python can do right now. So, We are now calling spring boot to python flask API. Utilizing the power of technology by mixing them is many times a good idea. More on reddit.com
🌐 r/SpringBoot
6
5
March 9, 2024
🌐
GitHub
github.com › amemifra › Spring-Jython
GitHub - amemifra/Spring-Jython: Java integration of Python script and classes into a Spring Boot Web Application. Powered by Jython · GitHub
Java integration of Python script and classes into a Spring Boot Web Application. Powered by Jython - amemifra/Spring-Jython
Starred by 12 users
Forked by 11 users
Languages   Python 99.3% | Java 0.7%
🌐
DEV Community
dev.to › w4t3rcs › spring-boot-python-executor-integrating-java-and-python-oma
Spring Boot Python Executor: Integrating Java and Python - DEV Community
August 14, 2025 - spring-boot-python-executor enables safe and modular Python integration into Spring Boot applications. With AOP, REST, and gRPC support, the library is production-ready and easily extensible for custom use cases.
🌐
Medium
jxausea.medium.com › spring-boot-integrated-python-engine-quick-start-demo-24d3f96cc4aa
Spring boot integrated python engine quick start demo | by Harries | Medium
March 12, 2024 - package com.et.python; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } } https://github.com/Harries/springboot-demo ·
Find elsewhere
🌐
StackShare
stackshare.io › stackups › python-vs-spring-boot
Python vs Spring Boot | What are the differences? | StackShare
Development Paradigm: Python follows a more procedural and object-oriented programming paradigm, allowing developers to write code that is easier to understand and maintain. In contrast, Spring Boot follows a more declarative programming paradigm, providing developers with a higher level of abstraction and reducing the amount of boilerplate code.
🌐
Reddit
reddit.com › r/springboot › execute python script from spring boot
r/SpringBoot on Reddit: Execute Python script from Spring boot
November 29, 2023 - try{ ProcessBuilder processBuilder = new ProcessBuilder("C:\\Users\\abc\\anaconda3\\python.exe", "./someScript.py"); // first arg is the path to your Python and second arg is the path to your py script processBuilder.redirectErrorStream(true); // redirect errors to the same stream Process process = processBuilder.start(); int exitCode = process.waitFor(); if (exitCode != 0) { log.error("Error: Python script exited with code " + exitCode); } } catch (Exception e) { e.printStackTrace(); log.error("Error while running Python script: " + e.getMessage()); } ... I wrote how to call a bash script using groovy years ago. It's not exactly what you're asking but you may find some inspiration. https://www.jcfrancisco.dev/posts/testing-scripts-with-groovy/ Spring Boot Best Practices That Should Fail Your Build
🌐
Dreamix
dreamix.eu › home › insights › tech › how to use jython with spring boot
How to use Jython with Spring Boot - Dreamix
July 16, 2024 - And that’s all. We can use our python implementation just as we would use a normal Spring service. That was just a simple example but it wouldn’t be much different if we need to create more complex python classes that rely on external libraries, etc. We can also extend Java classes in Python.
🌐
Medium
medium.com › @w4t3rofficial › spring-boot-python-executor-integrating-java-and-python-7ebf6ebfa2d3
Spring Boot Python Executor: Integrating Java and Python | by w4t3rcs | Medium
August 14, 2025 - spring-boot-python-executor enables safe and modular Python integration into Spring Boot applications. With AOP, REST, and gRPC support, the library is production-ready and easily extensible for custom use cases.
🌐
Baeldung
baeldung.com › home › java › how to call python from java
How to Call Python From Java | Baeldung
August 27, 2025 - Learn the most common ways of calling Python code from Java.
🌐
ITNEXT
itnext.io › how-to-integrate-spring-boot-with-numpy-python-using-graalpy-abced925a6b8
How to Integrate Spring Boot with NumPy (Python) Using GraalPy | by Ivan Franchin | ITNEXT
June 4, 2025 - Jython is a well-known project, but it only supports Python 2.7 and doesn’t work with modern Python libraries like NumPy, which require Python 3 and native code support. That’s why GraalPy is a game-changer — it lets you use up-to-date Python libraries directly in your Java application. In this tutorial, we will demonstrate, step by step, how to create a REST endpoint in a Spring Boot application that receives two matrices.
🌐
Spring
docs.spring.io › spring-python › 1.2.x › sphinx › html › overview.html
1. Overview — Spring Python v1.2.1.FINAL documentation
I think there are plenty that are fine to use, like Django, TurboGears, Zope, CherryPy, Quixote, and more. Spring Python is meant to provide utilities to support any python application, including a web-based one. So far, the demos have been based on CherryPy, but the idea is that these features ...
🌐
PyPI
pypi.org › project › pyctuator
pyctuator · PyPI
Monitor Python web apps using Spring Boot Admin.
      » pip install pyctuator
    
Published   Jan 17, 2024
Version   1.2.0
🌐
Stack Overflow
stackoverflow.com › questions › 62690294 › spring-boot-python-integration
Spring boot - Python integration - Stack Overflow
Hi All I have been trying to get Spring boot to python integration , which I did successfully using two different method but both required downloading the python module, which initally i thought ok everything is in Python lib folder , as my python files are mostly using to fetcg data via Rest call ( Rest client ) i needed Python Requests Module to be add.
🌐
Quora
quora.com › Should-I-abandon-Spring-Boot-Java-for-Python-Django
Should I abandon Spring Boot/Java for Python/Django? - Quora
Answer (1 of 3): Python, being dynamically typed language, is a tool, that in the hands of a competent developer provides great power. With Django, you will be able to create your first web-based app capable of working with the data in a database using powerful admin interface within the course ...
🌐
GitHub
github.com › hendisantika › ask-me-anything › issues › 3
[ask] how to communicate with python with spring boot. · Issue #3 · hendisantika/ask-me-anything
April 6, 2019 - Hello sir. This term I wanna develop a project with both python and java. I'd like to use spring boot to do the web part, but there's a tough problem for me. I 've already finish the da...
Author   hendisantika