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 OverflowHi,
I want to execute a python script like someScript.py just like we do on ,python someScript.py . This will display some output on terminal. Now ,I want to execute the same python script from Java code or I want to create an RESTapi for that. I tried to PuthonInterpreter but no luck.
Please suggest.
[ask] how to communicate with python with spring boot.
How to call an internal Python service for a Java-based Spring Boot project - Stack Overflow
Run python script
How to run python script (and receive output) from java/spring-boot project which is inside a docker container? - Stack Overflow
Hello everyone.. i want to ask is it possible to add a python script like this?
I have a functional spring boot + react app for users and they already using it. But they have a new change request to add a button to download the file as an excel with templates and data was fetch from the db. My friend help me by building a python script to generate this file (since we think python is good for working with data)
Is it possible to add a button in my react front end to run the python script and download the data as excel?