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



Thanks to all who replied with suggestions. With the help of a college we figured out how to get the class variable set by using the JNI findClass procedure.

QDCXLATE( %size(l6Class)
: l6Class
: 'QTCPASC');

hxplvl6Class = FindClass(JNIENV_P: l6Class);

Murali.Rao@xxxxxxxxxxxxxxxxxxxxx 8/25/2009 3:58:59 AM >>>
In our production system, I developed java methods in websphere j2e and used in RPG to call directly those methods using class path setup and JNI functions. We are successful in it and the programs are working great, super fast, I recently forced my RPG/JAVA programs to use 64 bit JVM from 6.1.

At present you can only prototype Java methods (not java class names), and if your method is static, then you must specify it in prototype.

See below my example code, which works great in our live iseries and doing the business.

dXMLString s like(stringObject)
dXMLData s 500a
djavaClassName c 'packageName.className

djavaMethodName c 'methodname'
*
dGetSomething...
d pr o class(*java:String)
d extproc(*java:
d javaClassName:
d javaMethodName)
d static

/free

XMLString = getSomething();
if XMLString <> *null;
XMLData = ConvertStringToBytes(XMLString);
endif;

Murali.



-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Chris Beck
Sent: 24 August 2009 18:59
To: java400-l@xxxxxxxxxxxx
Subject: Re: Help calling java from RPG

I just started playing with that but I just get a ClassNotFoundException. I did some googling on that and there are a number of people that have not been able to get that to work from RPG.

bmorris@xxxxxxxxxx 8/24/2009 12:20:48 PM >>>
Chris Beck wrote:
Hello,

I am creating a RPG program that calls multiple Java method from RPG
and am having problems with one of them. In the code snippet below I am wondering how to set the hxplvl6Class field to the propper value? in Java I would just use the following: "Hxplvl6 hxplvl6 = em.find(Hxplvl6.class, l6number);"
...
D hxplvl6Class S O CLASS(*JAVA : 'java.lang.Class' )

/Free
HxpLvl6 = find(em:hxplvl6Class:l6Number)


Chris, just a guess ... maybe the forName() method in java.lang.Class would work.

hxplvl6Class = forname('HxpLvl6');
--
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l.


This email transmission and any documents, files or previous email messages attached to it may contain information that is confidential or legally privileged. If you are not the intended recipient, you are hereby notified that any disclosure, copying, printing, distributing or use of this transmission is strictly prohibited. If you have received this transmission in error, please immediately notify the sender by telephone or return email and delete the original transmission and its attachments without reading or saving in any manner.

The Evangelical Lutheran Good Samaritan Society.

--
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l.



Consider the environment and think before you print this email.

Registered Address: Fortis House Tollgate Eastleigh Hampshire SO53 3YA Registered Number: 354568 England
Authorised and regulated by the Financial Services Authority

This e-mail together with any attachments are intended for the addressee only and may be private and confidential. If you are not the intended recipient, or the person responsible for delivering it to the intended recipient, you must not open any attachments, or copy, disclose, distribute, retain or use this e-mail, including any attachments, in any way whatsoever; please return it to us immediately using the reply facility on e-mail.

Consider the environment and think before you print this email.


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