Hi Oti,
Thanks for your helpful response!
First of all, you forgot to specify the very important "-C NONE" option, so that is why you did not get an exception. Can you verify that jythonc gives an exception if you specify the option?
That said, I tried what you suggested and it helped with problem 2-3 (but not problem 1).
However - besides the problem with "-C NONE" not working - I am not happy with the fact that I have to locate all the *.py files in the root directory. I would prefer to be able to place the *.py files in the correct directoy for the package together with the associated *.java files.
Comments/Suggestions ?
Morten C.

Oti <ohumbel@yahoo.com> wrote:
[ Morten Christensen ]
> I have serious problems using jython(c) (2.1 + 2.2a0). Specificly, I
> get problems when I use jythonc to:
> a) Generate code in specific java package (default package is for
 toys only).
> b) Make a *.py file inherit from a simple java class (needed to make
> python callable from java).
> I have attached a VERY simple python file with a class that inherits
> from a VERY simple java class.
> From the project root, I try to compile (see bat file in ZIP file):
> jythonc -C NONE -package net.mypackage net/mypackage/*.py
> This will illustrate several bugs:
> 1) Jython will make a meaningless complaint about a missing *.class
> file in my project (it is not supposed to compile so it does not give
> any meaning)... Aparently, Jythonc does not like it when -C option
> and -package option is used together.
> 2) In addition to to the expected java file in jpywork\net\mypackage,
> jythonc will also generate the directories net\mypackage under the
> existing net\mypackage directory (i.e my project will now have an
> empy directoy with full path net\mypackage\net\mypackage). Extremely
> annying!
> 3) The generated java file will not inherit from the specified java
> class.
> I tried to drop the -C NONE option, but the two other bugs still
> remain (2 is even worse) so this does not work either.
> Any suggestions? I would really like to use Jython, but I can't with
> these kind of bugs.

Hello Morten
i simply couldn't believe that this should not work. So i tried,
although i am not too familiar with jythonc. Here are the steps to

- compile PythonAction.java with javac
this results in (in my case)
- make sure that the CLASSPATH environment variable points to the
directory just above /net/mypackage, in my case
- place the PythonHello.py file into the directory just above
/net/mypackage, in my case
- cd into this working directory
- from there, issue the jythonc command as follows:
jythonc --package net.mypackage PythonHello.py
processing PythonHello

Required packages:

Creating adapters:

Creating .java files:
PythonHello module
PythonHello extends java.lang.Object implements

Compiling .java to .class...
Compiling with args: ['c:\\jdk1.3.1_06\\bin\\javac', '-classpath',
0 Note: Some input files use or override a deprecated API.
Note: Recompile with -deprecation for details.

- Then you can test the resulting class with the following test
package net.mypackage;
public class PythonHelloTest {
public static void main(String args[]) {
PythonHello ph = new PythonHello();

Please note: i changed the import statement in PythonHello.py to
from net.mypackage import PythonAction
but i don't know if this had an impact

Best wishes,

Yahoo! Mail - Gratis: 6 MB lagerplads, spamfilter og virusscan