× 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 wasn't setting my classpath correctly. 

-----Original Message-----
From: Grizzly Malchow 
Sent: Friday, August 04, 2006 12:31 PM
To: 'Java Programming on and around the iSeries / AS400'
Subject: java.lang.NoSuchMethodError

Not quite sure where this should be posted. Here or RPG list, but I'll
start here. 
I have a really simple java method that I am trying to run from an RPG
program. I am able to run it when testing in WSDC, but I am not able to
run it from my RPG program. I keep receiving the error:
Java exception "java.lang.NoSuchMethodError: printConfirm" when calling
method "printConfirm" with signature "()S" in class "ordconfirm".      
My interpretation of this error is that the printConfirm method cannot
be found and that it has a data type of short as the signature. My
initial check was to verify my classpath, which looks correct.
I'm not sure where to look next.

Here is the java class 
 
public class ordconfirm{
        public static void main (String args[]){
        
          short returnCode = 0; 
          returnCode = printConfirm();
        }
  
        public static short printConfirm () {
           short retval = 0;
           
           try{
                //Code omitted     
           }
           catch (Exception de) {de.printStackTrace();}
              
           return retval;       
        }                       
}

Here is the RPG prototype

D OrdPrtConfirm   PR             5I 0 ExtProc(*JAVA:'ordconfirm':
D                                            'printConfirm')
D                                     STATIC
D jRtnCode        S              5I 0

Assuming I have my classpath setup correctly shouldn't the following
line execute the printConfirm method and at least not throw the error I
am receiving?
jRtnCode = OrdPrtConfirm(); 

Do I need to use a *CONSTRUCTOR to first instantiate the ordconfirm
class, or is that only necessary for classes that are not static?
Any help is greatly appreciated.
Regards Griz


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.