× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Group,

I have not been able to locate an example that works
showing how to call a non-static Java method. I even
tried the example from the RPG manual. I get RNX0301,
some weird things about this are that the method name
is truncated to four positions (it is defined as 100
in the message definition) and the signature is blank.

The example in the manual is flat out wrong. Here
is the prototype (note that there is not
java.lang.BigDecimal, it should be
java.math.BigDecimal.

D add PR O EXTPROC(*JAVA:
D 'java.lang.BigDecimal':
D 'add')
D CLASS(*JAVA:'java.math.BigDecimal')
D bd1 O CLASS(*JAVA:'java.math.BigDecimal') CONST

Anyway, I corrected the example and still get:

Cause . . . . . :   RPG procedure TSTJDOM in program TSTJDOM/DMORRIS
received
  Java exception "java.lang.NoSuchMethodError: add" when calling method
"add"
  with signature "" in class "java.math.BigDecimal".


Here is my prototype and code:

DbdAdd            PR              O   EXTPROC(

D                                       *JAVA:

D                                       'java.math.BigDecimal':

D                                       'add')

D
CLASS(*JAVA:'java.math.BigDecimal')
D BigDecimal                      O
CLASS(*JAVA:'java.lang.BigDecimal')
D                                     CONST


 C                   EVAL      wrkString = newString('50')
 C                   EVAL      bd1 = newBD(wrkString)
 C                   EVAL      bd2 = newBD(wrkString)
 C                   EVAL      bd3 = bdAdd(bd1: bd2)

David Morris


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.