Search code examples
javapythonjavafxjar

Running python script from jar file


I have been working on java app that uses python script to run some 3d visualization, it worked when I was running it from intellij but once I created jar file it just doesn't run. OS: MAC OS

How I run script: Process p1 = Runtime.getRuntime().exec("python3 vizualize3D.py");


Solution

  • The problem had multiple layers and solutions: 1. I didn't put .py file in jar build config 2. After putting it I always got an exception that it is null because of a typo in code 3. After trying many ways to run it this one worked Cannot run python script from java jar . The important thing is to check if you added py file to the build config and to run it in a proper way since python cannot runt files from the zip and compressed states.