|
From: Guillaume D. <gui...@po...> - 2005-11-04 09:57:06
|
Hello,
we're having problems passing a string array to a constructor. We construct
the array in PHP as follows :
$Array = new JavaClass("java.lang.reflect.Array");
$String = new JavaClass("java.lang.String");
$entries = $Array->newInstance($String, 2);
$entries[0] = 'hello';
$entries[1] = 'world';
and we call the constructor as follows :
try {
$req = new javaClass('MyApp');
$req->ProcessFunction($Array);
} catch(JavaException $ex) {
print "$ex";
}
The error message we get is:
[o(Exception):"java.lang.Exception: Invoke failed:
[c:MyApp]->ProcessFunction2(([Ljava.lang.String;)c:java.lang.reflect.Array).
Cause: java.lang.IllegalArgumentException: argument type mismatch"]
The constructor expects a String[] parameter.
Any clues on how to create a Java String[] from PHP?
I can create Integer, Date, Vector or String objects but arrays ...
I tried:
$String = new JavaClass("java.lang.String[]"); // silly but hey, that's what
debugging is all about :)
Any help would be much appreciated.
Thanks in advance!!
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.733 / Virus Database: 487 - Release Date: 02/08/2004
|