I have the following problem and I am asking for the better approach.
I have to execute a Python script from the inside of a Spring Boot project. The script should be pretty easy but was made by other people and if possible I want to avoid the needing of change it.
From what I have understand I have two options:
- From my Java code I execute a shell command, something like shown here: https://www.baeldung.com/run-shell-command-in-java
Using this approach probably I have to handle the operating system recognition of where my script run and deal with it.
- Using Jython to embedd Python code into my Java code but I really don't know how it works and if probably I will face compatibility code (the code was made from other people, it should be very easy but it is better if I have not to change something on this code).
So what way you suggest me?