Ok, here's what we've got so far. I'm still getting the same NoSuchMethod error, but the signatures still match.
The prototypes:
d Instantiate pr o extproc(*JAVA:
d 'com.WMS_BPCS_Integrator.ex-
d ecutable.ResendOrder':*constructor)
d ResendOrder pr o extproc(*JAVA:
d 'com.WMS_BPCS_Integrator.ex-
d ecutable.ResendOrder':'resendOrder')
d class(*JAVA:'java.lang.String')
d o class(*JAVA:'java.lang.String')
d const
d o class(*JAVA:'java.lang.String')
d const
d string pr o extproc(*JAVA:
d 'java.lang.String':
d *CONSTRUCTOR)
d value 32000a const varying
The procedure calls:
callP SetEnvVar(); (this just sets up the home directory and classpath)
callP Instantiate();
ResendOrder(ReturnMsg:string(wmfac):string(charOrd));
The declaration of the java class and method:
public class ResendOrder
{
public String resendOrder(String Facility,String Order)
{...}
}
-----Original Message-----
From: Barbara Morris <bmorris@xxxxxxxxxx>
To: java400-l <java400-l@xxxxxxxxxxxx>
Sent: Tue, Mar 8, 2011 1:19 pm
Subject: Re: Signature mismatch when calling java prototype
On 2011/3/8 10:11 AM, mikemonger@xxxxxxx wrote:
Ok, I'm officially at my wits end. I've written a java class which
ccepts an array of string objects and returns a string. Here is the
rototype in the RPG program:
Mike, I'm a bit confused about what you said here. You said that the
ava class returns a string. Normally, I'd just think you meant to say
java method", but since you used the name "main" for the method, I'm
ondering if you're hoping that you can also use the RUNJVA command to
all this main method and get the value back.
I tried creating a Java class with a main method like yours, and it
reated the Java class ok, and I was able to call the main method with
our prototype after I added the STATIC keyword in RPG (and changed the
ame of the class to my class's name).
But I wasn't able to use RUNJVA to call the class method. I had to
hange the method to have the usual signature before I could use RUNJVA
o call the class.
public static void main(String args[])
So I'm thinking that your Java method will be easier to understand if
ou use the name "resendOrder" for that method, instead of using the
ame "main", since using the name "main" could cause confusion.
-
his is the Java Programming on and around the IBM i (JAVA400-L) mailing list
o post a message email: JAVA400-L@xxxxxxxxxxxx
o subscribe, unsubscribe, or change list options,
isit:
http://lists.midrange.com/mailman/listinfo/java400-l
r email: JAVA400-L-request@xxxxxxxxxxxx
efore posting, please take a moment to review the archives
t
http://archive.midrange.com/java400-l.
As an Amazon Associate we earn from qualifying purchases.