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



We've invoked java methods from RPG quite successfully. You build a prototype for the java methods and use them in your code just like you would RPG subprocedures. The only real trick is to return fixed length byte arrays from java methods and configure your prototype to expect an RPG character field of that length. Best to pass fixed length byte arrays as parameters. Of course integers and floats work, too, as parameters and return values. Decimal data from RPG is ugly to cope with in java and is best passed as one of the former.

When you use java from RPG, a jvm will be started for the job by the system infrastructure. Starting a jvm is relatively slow in comparison to loading an RPG program. Once the jvm is started, performance is quite acceptable.

You have to be careful about memory management.

-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Thorbjoern Ravn Andersen
Sent: Tuesday, January 18, 2011 2:28 PM
To: Java Programming on and around the IBM i
Subject: Re: Java class return data to calling CL program

Den 18/01/11 21.17, David Gibbs skrev:
Jason Abreu wrote:
How would you return a value from an executable Java class to a CL program?
Have the java program store the results in a data area.
Note that I don't believe the Java program can easily access QTEMP.

Is there any RPG coders who have experimented with invoking the JVM from their program instead of going through the JAVA/RUNJVA command, in order
to be able to return values as Jason wants to do? Any experiences?


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