1

I am a beginner in Python and I need to call .py script from Java code. I have installed jython but the tutorials I am getting online has material where they are importing Java packages in Python code. But my query is the other way round.

I just need a simple code in Java which is able to run Python scripts(.py).

Any leads will be highly appreciated.

1
  • just search on google "call .py script from java code" and get the answer Process p = Runtime.getRuntime().exec("python yourapp.py"); Commented Mar 20, 2018 at 8:56

1 Answer 1

1

Use jython library or run in CMD:

String command = "python script.py";
Process p = Runtime.getRuntime().exec(command);
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.