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



I am trying to call Jave from RPGLESRC. I keep running into RNX0301 when executing the RPGLE program. I have been at it 3 days and sure could use some guidance.

Message . . . . : Java exception received when calling Java method.
Cause . . . . . : RPG procedure PRCPWDIRG in program BLALOCK/PRCPWDIRG
received Java exception "java.lang.NoClassDefFoundError:rpgExample.Item" when calling
method "<init>" with signature "()V" in class "Item".

I tried for two days to get past this error with my own class and RPG. Yesterday I decided to see if I could make RPGLE and Java work together with an example from the Internet. https://www.mysamplecode.com/2011/06/call-java-from-rpgle-explanation-with.html This is a well thought out example.

I wanted to eliminate coding errors in my RPGLE and Java, to minimize the possibility that this is a signature error. Still getting the same error.

I created an Eclipse project, rpgExample. I copied the Java source from the example into two files, Item.java and GetItem.java. In Eclipse I exported them to the IFS as a jar file, named rpgExample.jar. The destination was /iasp1/java/prcExample. So now I have the jar in /iasp1/java/prcExample/rpgExample.jar.

I create the RPGLE program as BLALOCK/QRPGLESRC (PRCPWDIRG). I changed the package name from "com.as400samplecode" to match my package name of "rpgExample" in both Java and RPGLE.

I used this statement at the top of the RPGLE program:
cmdString = 'ADDENVVAR ENVVAR(CLASSPATH) ' +
'VALUE(''/iasp1/java/prcExample/rpgExample.jar'')' +
'REPLACE(*YES)';
runCmd(cmdString);

I checked the value of CLASSPATH after executing the program with WRKENVVAR. The value was
CLASSPATH '/java/prcExample/rpgExample.jar'
That is what I expected. I checked the CLASSPATH with WRKLNK. It was found.

The execution fails with the RNX0301 error.

I cannot understand what is going on. I'd appreciate some advice. I can send the source code to you.

Thanks






Bill Blalock
Complete Payment Recovery Services
C (205) 292-0725
E Bill.Blalock@xxxxxxxxxxxxx<mailto:Bill.Blalock@xxxxxxxxxxxxx>

The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you. Message Encrypted via TLS connection

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.