I need to pass a java string value (a path to a pdf file) to a function in the Jython interpreter, that is os.startfile(filename, "print")
(where filename is the string). So i tried to write it like this:
import org.python.util.PythonInterpreter;
PythonInterpreter interpreter = new PythonInterpreter();
interpreter.set("filename", fileDaStampare);
interpreter.exec("import os");
interpreter.exec("os.startfile(filename, \"print\")");
but it returns me this error when I execute tha java program:
console: Failed to install '': java.nio.charset.UnsupportedCharsetException: cp0. Traceback (most recent call last): File "", line 1, in AttributeError: 'module' object has no attribute 'startfile'
What can I do to execute this little piece of code in the Python interpreter?