From: paolo <pl...@ka...> - 2008-02-19 19:02:53
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> </head> <body bgcolor="#ffffff" text="#000000"> <font face="Times New Roman, Times, serif">In which path the exefile method looks for run the script ?<br> <br> for example, why this code not working ?<br> <br> <br> public class Test<br> {<br> <br> public static void main(String[] args)<br> {<br> ................<br> System.out.println("Inizializzazione di Jython...");<br> Properties system_prop = System.getProperties();<br> system_prop.put("java.class.path", System.getProperty("user.dir")+File.separator+"Lib");<br> PythonInterpreter interp;<br> PySystemState python_prop = new PySystemState();<br> PyString lib_path = new PyString(System.getProperty("user.dir")+File.separator+"Lib");<br> python_prop.path.append(lib_path);<br> interp = new PythonInterpreter(null,python_prop);<br> interp.execfile("myscript.py")<br> ..................<br> }<br> <br> }<br> <br> Exception<br> </font><font face="Times New Roman, Times, serif">IOError: File not found - myscript.py (No such file or directory)</font><br> <font face="Times New Roman, Times, serif"><br> <br> <br> this is my directory structure:<br> <br> -------->/home/maurus/workspace/prova<br> +----->Lib<br> +------>myscript.py<br> +----->src<br> +------>Test.java<br> +----->bin<br> +------>Test.class</font><br> <br> thanks<br> <br> </body> </html> |