0

I need to create a Java application which sends some input parameters to a python script and sends some output back to my java application.

I cannot run the script in my java code using jython Or similar things as the python scripts are build on demand and I may need to add new scripts every now and then. So this should not impact my java app.

My java application will be running on a container and based on a few condition check it might have to select 1 of the py scripts from suppose 100 scripts and run it. And again the condition later on may change and a different script has to run at that time

I went through many websites and tutorials on the net but did not find anything relevant.

Has someone tried anything similar?

Roshni
  • 137
  • 1
  • 2
  • 11
  • 1
    @shahaf I don't think it's a dupe. – Aniket Sahrawat Oct 14 '19 at 16:57
  • Add python to your java inage? – Thorbjørn Ravn Andersen Oct 14 '19 at 16:57
  • 1
    @sharaf this is something different if the python executable is elsewhere than the java executable. – Thorbjørn Ravn Andersen Oct 14 '19 at 16:59
  • the fact this is docker you are talking about, means containers need to talk to each other, there are many ways to do it, sending message via socket, via files and etc... (building new functionality to the python and java services) I think you better run both java and python on the same docker container and use the following to invoke the python script https://stackoverflow.com/questions/27267391/running-a-py-file-from-java – shahaf Oct 14 '19 at 17:04
  • My java application will be running on a container and based on a few condition check it might have to select 1 of the py scripts from suppose 100 scripts and run it. And again the condition later on may change and a different script has to run at that time. I will try using Websocket and let you guys know if I can get a solution – Roshni Oct 14 '19 at 18:22

0 Answers0