|
From: Jim A. <Ji...@do...> - 2001-10-16 06:48:15
|
Not sure if this is what you're looking for, but it's worth a look. It's similar to the swing demo 'console.py', but all-java: ftp://iee.umces.edu/SME3/JConsole/SPyConsole.zip > -----Original Message----- > From: Matthew Cornell [mailto:co...@cs...] > Sent: Monday, October 15, 2001 5:00 AM > To: pe...@in... > Cc: jyt...@li... > Subject: Re: [Jython-dev] Q: how to run cleanup method when > interpreter > exits? > > > Thanks for the ideas. I'm sorry I wasn't clear about the scenario: We > were investigating supporting users using our program's class while > working in the interpreter on the command line. For example: User > starts jython script, creates an instance of our class (prox = > Proximity(xx)), and works with that instance (prox.foo()). The problem > was that we needed some cleanup code to run because instatiating an > instance of our class allocates some resources (JDBC connections, > etc.) However, since the *interpreter* (not an application of ours) is > in control, we were looking for hooks that would let us clean up when > the interpreter (or VM) exits. > > We've now decided that we should be in control, so I'm working on > creating a Swing-based Jython console. I'm looking at using something > like this: > > Py.getSystemState().stderr = new > PyFile(jtextAreaPrintStream, "<stderr>"); > > The trick is creating a JTextArea that acts like an InputStream and > OutputStream. I've read a bunch of newsgroup posts on redirecting > stdin and stdout, and the fullest solution seems to be a Rhino > (JavaScript in Java) tool: > > http://www.mozilla.org/rhino/ > > http://lxr.mozilla.org/mozilla/source/js/rhino/toolsrc/org/moz > illa/javascript/tools/shell/ > > If anyone has alread created one of these for a Jython interpreter I'd > be grateful if you'd share the source! > > Sincerely, > > matt > > > _______________________________________________ > Jython-dev mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-dev > |