From: Owen D. <ow...@ba...> - 2006-10-28 03:22:57
|
I stumbled across the solution: Name my .py file something other than RandBoxes.py! So...if you end up with a weird error from jython looking like: 1 ./jpywork/RandBoxes.java:216: main(java.lang.String[]) in RandBoxes cannot override main(java.lang.String[]) in processing.core.PApplet; overridden method does not throw java.lang.Exception .. then simply change your .py file to have a different name from the class. Why?? Well, apparently, the .java file created by jythonc includes its own main, which has a non-standard main() signature, i.e. throws an exception. So if you're .py file is Foo.py, it basically wraps a class Foo around all your jython code, and includes a main() which raises an exception. Thus, if my case, I was building a RandBoxes class subclassing an applet class, PApplet, which naturally enough *also* had a standard main() static method so it could also be launched as an application. But because I but my various classes etc in RandBoxes.py, jythonc dutifully built a class of that name to encompass all the classes and code in the .py file. One of the classes was named RandBoxes, and, also apparently, jythonc "helps you" by merging the outermost class utilities into the class name of the same name of the .py file. Confusing? You bet. Simple answer: Don't name your .py file the same name as you classes included in the .py file IF one of them also subclasses a Java main() method! Whew! I'll write this up on my site shortly. -- Owen Owen Densmore http://backspaces.net |