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





Everyone,

I got this working tonight. I had not put the .class file inside of a
directory structure that matched my package name as well as qualify the
class with the package name in the ExtProc.

Thanks anyways :-P

Robert Newton
EDPS
Electronic Data Processing Services
Software Engineer
rnewton@xxxxxxxxxxxxxxxxx

This communication is confidential and is intended to be privileged. If
there is a problem with this transmission, please contact the sender. If
the reader of this message is not the intended recipient, or the employee
or agent responsible to deliver it to the intended recipient, you are
hereby notified that any dissemination, distribution or copying of this
communication is strictly prohibited.


|---------+---------------------------->
|         |           Rob Newton       |
|         |                            |
|         |           01/08/2007 12:17 |
|         |           PM               |
|---------+---------------------------->
  
------------------------------------------------------------------------------------------------------------------------------|
  |                                                                             
                                                 |
  |       To:       java400-l@xxxxxxxxxxxx                                      
                                                 |
  |       cc:                                                                   
                                                 |
  |       Subject:  Calling Prototyped (Homebrew) Java from RPGLE               
                                                 |
  
------------------------------------------------------------------------------------------------------------------------------|



I am working to get an RPGLE to call a prototyped JAVA program. I've
searched the archives and found a post from Mike E back in 2002 about a
similar problem. He apeared to get it working but I cannot. I have read
chapter 11 in the user guide called RPG and Java (or something like that)
linked in the 2002 thread by Barbra Morris I believe about prototyping java
calls in rpg. Does anyone see anything wrong with what I am listing below??

Here is my prototype


**********************************************************************
      *  getKeyByNumber returns the project key
      *    I am getting an error evertime saying the class is not found.

**********************************************************************
     D getKeyByNumber  pr            10i 0 ExtProc(*JAVA:
     D                                             'cmpapi':
     D                                             'getKeyByNumber')
     D                                             STATIC
     D  projectNumber                10i 0 Value

Here is the java method

      public static int getKeyByNumber(int projectNumber)

My current directory gets set in the front of the RPG app to the path where
the java app lives with QCMDEXC

      CHGCURDIR DIR('/QIBM/UserData/runjava/')

My CLASSPATH envvar gets set at the front of the RPG app as well

      ADDENVVAR ENVVAR(CLASSPATH) VALUE('.:/QIBM/UserData/runjava/')
REPLACE(*YES)

Here is the location of my java program (1.1.1.1 reperesents the IP to our
development machine running V5R4)

      \\1.1.1.1\root\QIBM\UserData\runjava

Here is the Message I get when I run this in debug

      Message ID . . . . . . :   RNX0301
      Message . . . . :   Java exception received when calling Java method.
      Cause . . . . . :   RPG procedure JAVATEST in program DSLIB/JAVATEST
received
        Java exception "java.lang.NoClassDefFoundError: cmpapi" when
calling method
        "getKeyByNumber" with signature "(I)I" in class "cmpapi".

Here is the result of running javap -s cmpapi from qshell

      public static int getKeyByNumber(int);
        Signature: (I)I


One thing that I have tried different is using a .class file as well as
trying a .jar. I think that it is the .class file that I am suposed to be
putting in  \\1.1.1.1\root\QIBM\UserData\runjava since that is the only one
that will work with the javap -s call to get the signatures. However I am
not sure. I do not see this mentioned in the manual, but it of course could
be something that a real java programmer would know first hand.

Can someone show a working example of calling a homebrew java app from RPG?
All of the examples I see call java.lang.* or java.math.*, which of course
I can get to work just fine. I just cannot get my own stuff to work.

Thanks in advance.

Robert Newton
EDPS
Electronic Data Processing Services
Software Engineer
rnewton@xxxxxxxxxxxxxxxxx

This communication is confidential and is intended to be privileged. If
there is a problem with this transmission, please contact the sender. If
the reader of this message is not the intended recipient, or the employee
or agent responsible to deliver it to the intended recipient, you are
hereby notified that any dissemination, distribution or copying of this
communication is strictly prohibited.


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.