Re: Call system API from Java
Barbara Morris <[email protected]>
| Newsgroups | gmane.comp.lang.as400.java |
|---|---|
| Organization | IBM |
| Message-ID | <[email protected]> |
On 2020-02-24 11:44 a.m., Pete Helgren wrote:
> There really isn't any particular reason, it just seems like "native" is
> the better way to go, especially if I can 1) Learn something new and 2)
> If the effort isn't a whole lot more than using JT400.
>
> I have done a bit of JNI stuff in Windows/Linux and with wasn't too
> hairy. Just wondered about IBM i and doing the same.
>
To use JNI for calling from Java, you'd need a native method on the
native side.
It's pretty easy to write a native method in RPG. You just need to code
your EXTPROC with *JAVA and the class name:
EXTPROC(*JAVA : 'MyClass' : MyMethod)
And you need to create the Java class to tell Java about where the
native method is.
https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_74/rzasc/callnatmeth.htm
There's no support for data structure parameters, so depending on what
you wanted from the API, you might need a lot of parameters.
--
Barbara
--
This is the Java Programming on and around the IBM i (JAVA400-L) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/java400-l
or email: [email protected]
Before posting, please take a moment to review the archives
at https://archive.midrange.com/java400-l.
Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com