|
Thanks Barbara. I am sure I did something wrong!.. Here's what I am trying to do. I am trying to create a 'url' instance of java.net.URL class with whatever I am passing in as a parm. In Java, we would call the method as url = new URL(); and url.getHost(); but now, I am confused in AS/400. Should I enter Class2 (to refer to my instance) as 'java.net.URL url' or plain url or 'java.net.URL'? I tried the java.net.URL and since it is not a static method, and I just call getHost(), the the rpgle does not compile, the error is Msg id Sv Number Seq Message text *RNF7588 30 81 008900 The call to Java method GETHST requires an object as the extra first parameter. My code is D gethst PR 100A ExtProc(*JAVA: D 'java.net.URL': D 'getHost') D varying ** c IF curl <> ' ' c Eval sUrl = newString(%trim(curl)) c Eval url = newURL(sUrl) c ENDIF c Eval rtnText = gethst() c EXSR $setRtnCode I then changed the getHost() to getHost(url), which is the instance of URL I created the line above with newURL(). c Eval rtnText = gethst(url) The rpg now compiles but I get a java exception (obviously since that is wrong call to the method). (Is there a manual I could refer to, for these codes?) Thanks for all your help! Sudha -----Original Message----- From: Barbara Morris [mailto:bmorris@ca.ibm.com] Sent: Thursday, October 31, 2002 9:51 AM To: java400-l@midrange.com Subject: Re: Call method without parm SRamanujan=dsjOEj4+x6mynpMCO8VUG9BPR1lH4CV8@public.gmane.org wrote: > > I am new to java calls from rpgle. I was trying to validate a URL and get >the server and port from the url using getHost and getPort methods. I could >get up to URL constructor, but when I call the getHost I seem to have >problems. I keep getting getHost call error or class error. > > D Class C 'java.net.URL' > D Class2 C 'url' > > * java method > D gethost PR 100 ExtProc(*JAVA:Class2:'getHost') > D STATIC > It would be useful if you posted the errors you are getting. What is the 'url' class? getHost() is a non-static method in java.net.URL. Is it also static a method in class 'url'? Here's a tip: in your RPG code, always put the Java method information in a comment. * Class: java.net.URL * Method: String getHost() D getHost PR 100 ExtProc(*JAVA:'java.net.URL':'getHost') Barbara Morris _______________________________________________ This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l or email: JAVA400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l.
As an Amazon Associate we earn from qualifying purchases.
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.