Hello Pivot users,

Does anyone have experience using Pivot with JVM scripting languages like JRuby 
or Jython? I looked around and some time back someone asked a similar question 
for JRuby and hit the same problem as I did.

My code:

#!/usr/bin/env jython
from org.apache.pivot.beans import BXMLSerializer
from org.apache.pivot.collections import Map
from org.apache.pivot.wtk import Application
from org.apache.pivot.wtk import Display
from org.apache.pivot.wtk import Window
from org.apache.pivot.wtk import DesktopApplicationContext
from java.lang import Runnable, Exception as Ex
from javax.swing import SwingUtilities
import sys,subprocess,os,re, traceback

class Test(Application):
        def __init__(self):
                self.window = None
                self.bxmlSerializer = BXMLSerializer()
        def startup(self, display, properties):
                self.window = 
self.bxmlSerializer.readObject("file:///home/myuser/test.bxml")
                self.window.open(display)
        def shutdown(self, optional):
                if self.window != null:
                        window.close()
                return False
        def suspend(self):
                pass
        def resume(self):
                pass

class Task(Runnable):
        def __init__(self, argv):
                self.argv = argv
        def run(self):
                DesktopApplicationContext.main(Test, self.argv)

if __name__ == "__main__":
        try:
                SwingUtilities.invokeAndWait(Task(sys.argv[1:]))
        except:
                traceback.print_exc(file=sys.stderr)
                sys.exit(192)

Throws an exception:

java.lang.ClassNotFoundException: org.python.proxies.__main__$Test$1
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:186)
        at 
org.apache.pivot.wtk.DesktopApplicationContext.main(DesktopApplicationContext.java:606)
        at 
org.apache.pivot.wtk.DesktopApplicationContext.main(DesktopApplicationContext.java:881)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at 
org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186)
        at 
org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:204)
        at org.python.core.PyObject.__call__(PyObject.java:404)
        at org.python.core.PyObject.__call__(PyObject.java:408)
        at org.python.pycode._pyx0.run$9(/home/jnunezzu/pivot.py:39)
        at org.python.pycode._pyx0.call_function(/home/myuser/pivot.py)

Any help will be greatly appreciated.

Thanks,

--Jose

_______________________________________________

This message is for information purposes only, it is not a recommendation, 
advice, offer or solicitation to buy or sell a product or service nor an 
official confirmation of any transaction. It is directed at persons who are 
professionals and is not intended for retail customer use. Intended for 
recipient only. This message is subject to the terms at: 
www.barclays.com/emaildisclaimer.

For important disclosures, please see: 
www.barclays.com/salesandtradingdisclaimer regarding market commentary from 
Barclays Sales and/or Trading, who are active market participants; and in 
respect of Barclays Research, including disclosures relating to specific 
issuers, please see http://publicresearch.barclays.com.

_______________________________________________

Reply via email to