Dear Jython Developers,

 

I have a java application and an attempting to integrate a Jython utility another developer wrote into it and call it within my java code. Using your documentation it appeared I needed to embed the Jython utility using PythonInterpreter but it pukes on any import java module.

 

What am I doing wrong, or is what I am attempting to do not supported?

 

Thanks in advance for any help!

 

Jim

 

Here is my puking attempt:

 

package test.creekpath.verification.AIMaze.utilities;

 

import org.python.util.PythonInterpreter;

import org.python.core.*;

 

import java.util.Properties;

 

public class JythonOperations

{

            public void runcatsutility() //String[] inputparameters

            {

                        Properties jythonsysprops = new Properties();

 

                        Properties jythonregprops = new Properties();

 

                        jythonregprops.setProperty("python.home",

                                                                                                "/jython-2.1");

 

                        jythonregprops.setProperty("python.path",

                                                                                                "/jython-2.1");

//put back in if need

/*

                        jythonregprops.setProperty("python.cachedir ",

                                                                                                "/jython-2.1/cachedir");

*/

 

                        PythonInterpreter.initialize(jythonsysprops,

                                                     jythonregprops,

                                                 new String[0]); //String[] argv

 

                        PythonInterpreter interp =

                            new PythonInterpreter();

 

                        System.out.println("Loading Cats Utility");

            interp.execfile("C:\\jython-2.1\\__run__.py");

 

            } //end method runcatsutility

} //end class JythonOperations

 

Here is the bat file that works running from the Jython directory:

 

@echo off

rem set JAVA_HOME=C:\Program Files\JavaSoft\JRE\1.3.1

 

set ARGS=

 

:loop

if [%1] == [] goto end

        set ARGS=%ARGS% %1

        shift

        goto loop

:end

 

set SYMPY_HOME=C:\jython-2.1

set JAVA_HOME=c:\AIM\ThirdParty\jdk1.3-win32

 

 

"%JAVA_HOME%\bin\java.exe" "-Dpython.home=%SYMPY_HOME%" -classpath "%SYMPY_HOME%\jython.jar;%SYMPY_HOME%\jylib.jar;C:\AIM\ThirdParty\Oracle\JDBC\lib\classes12.zip" org.python.util.jython __run__.py %ARGS%