Issue1621

classification
Title: Cannot invoke Java method when using Jython with JSR223 interface
Type: behaviour Severity: normal
Components: Core Versions: 2.5.1
Milestone:
process
Status: closed Resolution: invalid
Dependencies: Superseder:
Assigned To: Nosy List: frbo, zyasoft
Priority: Keywords:

Created on 2010-06-16.15:15:23 by frbo, last changed 2010-06-16.16:52:14 by zyasoft.

Messages
msg5816 (view) Author: Frank Bos (frbo) Date: 2010-06-16.15:20:41
public class JythonTest
{
  public static void main(String anArguments[]) throws Exception
  {
    jythonDirect();
    jythonJSR223();
  }

  private static void jythonDirect()
  {
    PythonInterpreter myInterpreter = new PythonInterpreter();
    myInterpreter.exec(
      "from java.lang import String\n" +
      "myString = String('Test')\n" +
      "myResult = myString.substring(1,2)");

    System.out.println("Direct Jython result: " +
      myInterpreter.get("myResult"));
  }

  private static void jythonJSR223()
      throws ScriptException
  {
    ScriptEngine myEngine = new ScriptEngineManager(). 
      getEngineByName("jython");
    if (myEngine == null)
    {
      throw new RuntimeException("Script engine not found!");
    }

    myEngine.eval(
      "from java.lang import String\n" +
      "myString = String('Test')\n" +
      "myResult = myString.substring(1,2)");

    System.out.println("JSR223 result: " + myEngine.get("myResult"));
  }
}
msg5817 (view) Author: Jim Baker (zyasoft) Date: 2010-06-16.16:52:14
This is a support issue (JSR 223 works fine with Jython), so please use the jython-users mailing list or the #jython IRC channel. If you identify a specific bug in JSR 223, then report it here.
History
Date User Action Args
2010-06-16 16:52:14zyasoftsetstatus: open -> closed
resolution: invalid
messages: + msg5817
nosy: + zyasoft
2010-06-16 15:20:42frbosetmessages: + msg5816
2010-06-16 15:15:23frbocreate