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



 >> but you must be careful with threading issues. The rpg must not call any
java function that might start another thread.

Agreed but I'm mostly interested in Java calling RPG than the other way
round.  There are also problems with RPG creating Java object in that you
have to do your own "garbage collection" as the JVM doesn't know about nay
object the RPG creates and can't clean them up.

As to examples - Barabara Morris wrote a piece for iSeries Magazine but I
can't find the article on the web site.  The source code can be found at our
old companies web site (they haven't cleaned up the pages so they are still
there) the URL is http://www.e400.com/JonSusan/HansAndBarbaraMay.html and
click on the "Get source files" link alongside the Java reference.

The RPG manual has a lot of good stuff in it on the subject but the examples
are not too wonderful.

In essence, all you need to do is add:

EXTPROC(*JAVA:'classname' :'methodname') to the Prototype of the
subprocedure.  Then you simply add the native method prototype to your Java
code, and make sure you invoke the System.load method in your class to load
the service program containing the native method(s).

The only real drawback is that because the compiler does such a lot of work
on the parms etc. "under the hood" you can't call the same subproc from RPG.
That means that for any subprocs used by both Java and RPG the Java has to
use a stub procedure to call the "real" thing.

I have some materials in my V5 presentation that you are welcome to have a
PDF of if you e-mail me OFF-LIST.

Jon Paris
Partner400




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.