Hi Thorbjørn,

Let me make some multiple responses while my current project deploys to
a remote client:

Charles Witt is completely correct about static methods. They are
handy for utility functions when no instance is necessary to keep
information about the object. Using local variables, of course.

To Darren: I'm not one of those who insist on "pure" Java
solutions. There are several way for Java and other languages to work
together without JNI, multiple JVM's, and all the grief.

Thorbjørn, to your question here's a knee-jerk answer. JTOpen provides
access to both data queues (which many here seem to prefer) and messaging
(native AS/400, not JMS,) which I generally use. Either can be used to communicate with the CL program in the same way you might with RPG, COBOL, or any other program. You could send back different exit codes to indicate conditions to be checked, or just rely on messaging altogether. If you want a nearly WORA on the Java side, you could use JMS in Java, with an adapter (hence "nearly") to get it to the data or message queue. That's the technique Mule uses (or used to use; I haven't looked at it for a while.)

HTH; guaranteed to be worth what you paid for it.

Joe Sam

Joe Sam Shirah - http://www.conceptgo.com
conceptGO - Consulting/Development/Outsourcing
Java Filter Forum: http://www.ibm.com/developerworks/java/
Just the JDBC FAQs: http://www.jguru.com/faq/JDBC
Going International? http://www.jguru.com/faq/I18N
Que Java400? http://www.jguru.com/faq/Java400

----- Original Message ----- From: "Thorbjoern Ravn Andersen" <ravn@xxxxxxxxxx>
To: "Java Programming on and around the iSeries / AS400"
Sent: Wednesday, March 31, 2010 1:51 PM
Subject: Invoking Java by programmatically calling a JVM to get result

Den 31/03/10 18.29, Joe Sam Shirah skrev:
haven't really analyzed your efforts. I've maintained from day one that
is much better off avoiding calling Java from RPG . My "day one" is from
about 1997 - I'll leave it up to you to decide whether I now have 13 years
of Java experience or one year 13 times. You can check this list for
reasons to avoid JNI. I've never had a situation where it was required.
One benefit, as you've noticed, is large performance gains.

I've started a new topic because I'd like to hear your and others
opinion on how our needs might be solved.

We have a situation where we from CL invoke a Java program with
RUNJVA/JAVA and pass in parameters through properties and command line
arguments. Very nice. Works well.

The problem arising in the horizont is the need to be able to pass back
more than just the exit value to the invoking CL program. When I
researched the matter on V5R3 Classic JVM it appeared that this could
not be done through the RUNJVA/JAVA command.

Would the way to do this, be to follow IBM instructions on how to invoke
a JVM, call a given method and parse the returned value and then discard
it? I am not comfortable with following that approach and would really
prefer not to if any standard CL command could do it easily.

Have anybody worked with the JVM like this and lived to tell the tale?

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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

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