Right now I have the absolute file path hardcoded into my Java program so that the Python script can be ran. However, when my program is deployed onto the company's platform, this file path will no longer be correct. The script is located in the same directory of the class which calls it, and this directory structure will not change. Is there a way to run the script just based on it being in the same directory?
2 Answers
After trying what @Confiqure suggested, I found that the path was going one step too far into the directory structure of my program. Instead I tried:
String path = new File("").getAbsolutePath + "/my/path/to/script";
The new File("").getAbsolutePath returned the path to my application and from their I hardcoded the relative path, knowing that the path relative to my own application would never change.
org.python.util.PythonInterpreter?