下面是从 Java 调用 Python 的给定代码
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new test1( ).setVisible(true);
}
});
try {
PythonInterpreter.initialize(System.getProperties(), System.getProperties(), new String[0]);
PythonInterpreter interp = new PythonInterpreter();
interp.set("firstName", args[0]);
interp.set("lastName", args[1]);
interp.execfile("C:\\Users\\priyank\\Desktop\\pythontest.py");
}
catch (Exception e)
{
e.printStackTrace();
}
}
我收到以下异常:
java.lang.ArrayIndexOutOfBoundsException: 0" error..
为什么我会收到此错误?