No version of java I have ever seen supports properties. Well not the
syntactic sugar type that .net offers anyway.

I think if you want to deal with arrays in JNI you should read this, its not
an RPG article but should help.

http://www.lkn.ei.tum.de/arbeiten/faq/man/JAVA-tutorial/native1.1/implementi
ng/array.html

But basically arrays are a sort of weird hybrid of a built in type and a
compiler helper. So you need to use the special JVM JNI methods like.

GetArrayLength(env,array)

Hope this helps


-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx]
On Behalf Of eftimios pantzopoulos
Sent: 11 February 2011 09:33
To: java400-l@xxxxxxxxxxxx
Subject: Accessing array property length through JNI



I've been investigating the way that JNI works and I've been writing Java
code and then trying to get the same thing working from RPG.

The play code involves the String split method and the arrayname.length
property. This all works in the Java version.

I mistakenly thought that length was an instance variable and wasted a lot
of time until a real Java developer pointed out that it was a property of
the Java array. The array is a native Java type so of course there is no
instance variable. I've been using Tom Snyder's book (Advanced Integrated
RPG) as my bible and was using the example code to obtain the Class Id anf
Field Id for length. The field id access was failing because (as I now
understand) there is no length instance variable.

So the question is - am I able to access the property value through JNI and
if so how.

Thanks in Advance




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2021 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.