以下は、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..
なぜこのエラーが発生するのですか?