Hi,

 

I am trying to use jythonc in order to produce a real java class out of a python one.

 

I have the following method with the « @sig » processing instruction.

 

My problem is that jythonc gives me an error : ValueError : can not find class : com.softwareag.belgium.xmlstruct.ErrorBag (full stack trace bellow)

 

Is it possible to specify to jythonc the location of the jar file where this class can be found ? I have tried the addpackages option but with no success.

 

Thank you in advance for your answer,

 

Jean-Christophe Castiaux

 

 

import os, sys

import appHelper

 

 

import appenv

#import xmlutils

from com.softwareag.belgium.rtf.app import app

from com.softwareag.belgium.utils.xsl import XSLHelper

from com.softwareag.belgium.xmlstruct import ErrorBag

 

import java

 

 

class MergeRtf(java.lang.Object):

 

    def getRtf(self, templateStream, outputStream, dataStruct):

        "@sig public void getRtf(org.python.core.PyFile templateStream, org.python.core.PyFile outputStream, com.softwareag.belgium.xmlstruct.ErrorBag dataStruct)"

        myTemplate = Template(templateStream)

        try:

          myTemplate.generate(outStream, struct = dataStruct, applyXSL = applyXSL)

        finally:

          outStream.close()

 

if __name__ == "__main__":

    myTemplate = Template(open (sys.argv[1]))

    outStream = open(sys.argv[3],"wb")

    try:

      myTemplate.generate(outStream, myObj = xmlObj(sys.argv[2]),

                                   applyXSL = applyXSL)

    finally:

      outStream.close()

   

 

Output:

 

jythonc --package "com.softwareag.belgium.rtf.nqrva"

        --deep

        --bean appNQRVA.jar

        --compiler c:\j2sdk1.4.2_05\bin\javac

        --addpackages "xmlstruct.jar"

        --compileropts "-classpath xmlstruct.jar"  *.py

 

 

Creating .java files:

  re module

  sre module

  UserDict module

  string module

  sre_compile module

  appHelper module

  sre_parse module

  javaos module

  MergeRtf module

 

Traceback (innermost last):

  File "C:\javasoft\jython-2.1\Tools\jythonc\jythonc.py", line 5, in ?

  File "C:\javasoft\jython-2.1\Tools\jythonc\main.py", line 300, in main

  File "C:\javasoft\jython-2.1\Tools\jythonc\main.py", line 221, in doCompile

  File "C:\javasoft\jython-2.1\Tools\jythonc\compile.py", line 389, in dump

  File "C:\javasoft\jython-2.1\Tools\jythonc\compile.py", line 325, in preprocessModule

  File "C:\javasoft\jython-2.1\Tools\jythonc\compile.py", line 312, in makeJavaProxy

  File "C:\javasoft\jython-2.1\Tools\jythonc\compile.py", line 58, in getsig

  File "C:\javasoft\jython-2.1\Tools\jythonc\compile.py", line 84, in insistJavaClass

ValueError: can not find class: com.softwareag.belgium.xmlstruct.ErrorBag