Assuming the script is in the jar file, you can get an input stream from the resource, and use it as the input to a Process created from the python interpreter:
// Note: the path to the script here is relative to the current class
// and follows strict resource name rules, since this is in a jar file
InputStream script = getClass().getResourceAsStream("visualize3D.py");
// The following creates a process to run python3.
// This assumes python3 is on the system path. Provide the full
// path to the python3 interpreter (e.g. /usr/bin/python3) if it's
// not on the path.
// The - option to python3 instructs it to execute a script provided
// as standard input.
Process process = new ProcessBuilder("python3", "-")
.start() ;
OutputStream out = process.getOutputStream();
byte[] buffer = new byte[1024];
int read = 0;
while((read = script.read(buffer)) != -1) {
pos.write(buffer, 0, read);
}
script.close();
For details on getting the correct path for the script, see How do I determine the correct path for FXML files, CSS files, Images, and other resources needed by my JavaFX Application?
python3 visualize3D.pydoPYTHONPATH=/path/to/your/python/project /path/to/your/interpreter/python /path/to/your/python/script.py. E.g. if your python project is in /home/devfofikicar/pythonproject and your python interpreter is at /usr/bin/python you doPYTHONPATH=/home/devfofikicar/pythonproject /usr/bin/python /home/devfofikicar/pythonproject/visualize3D.pyPYTHONPATH), the path of your python interpreter (/usr/bin/python) and the path to the python file that is to be executed. The files have to exist somewhere in your system. Find them and for now hardcode it and see if that works.PYTHONPATH.