× 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.



> How do I reference built in static final fields in Java objects/classes
> from RPG?

It's possible to do this using JNI calls, but it's not easy.  Personally,
I would just write some simple classes that get these fields, and then you
can just call them when you need them.  Or, if these are just constants
that'll never change, maybe create a /copy file to define the same
constants in RPG.

In case you are interested in retrieving them using JNI, here's an excerpt
from the ILE RPG Programmer's Guide:

    Accessing Fields in Java Classes

    RPG only supports calling Java methods; it does not support accessing
    Java fields. Normally, fields can be accessed through "get" and
    "set" methods, but it is also possible to access fields using JNI
    calls.

It then proceeds to give an example of using the JNI calls to get some
fields.

I found this in Chapter 11 of the ILE RPG Programmers Guide, which is
online here:
http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/rzahgrpgcode.htm

In chapter 11, I went to "RPG and Java" and then "Advanced JNI coding".
Good Luck...

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.