Works fine for me... Have you tried redirecting stdout and stderr to see what 
the Java error that is getting thrown is? (See link below for instructions) 


-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx] On 
Behalf Of Subhashree Panda
Sent: Monday 02 January 2006 13:10
To: java400-l@xxxxxxxxxxxx

I am following these steps:
1. MD DIR(java) 
3. Creating a member called test in QJAVASRC
open the member in edit mode and 
do - "S caps off" at the top of the seu to allow lower case
4.Then i write this java program in member 'test'.

public class test { 

static String mystring; 

public static String setMyString(String s) { 
mystring = s + "prog"; 
return mystring; 


5. CPYTOSTMF FROMMBR('/qsys.lib/ablib.lib/qjavasrc.file/test.mbr') 

6. wrklnk java
7. take option 5 and see the there
8. qsh 
9. javac /java/ 
10. wrklnk java (see if the class file is created or not)
11. create a RPGLE member in QRPGLESRC called TESTJAVA

This is my RPGLE program TESTJAVA which calls the Java method setMyString 
described in the above Java program:

D setMyString     PR              o   class(*java:'java.lang.String')           
D                                     extproc(*java:                            
D                                             'test':'setMyString')             
D                                     static                                    
D mystring                        o   class(*java:'java.lang.String')           
D makeString      PR              o   extproc(*java:'java.lang.String':         
D                                           *constructor)                       
D bytes                      65000a   const varying                             
D getBytes        PR           100a   Varying                                   
D                                     extproc(*java                             
D                                             :'java.lang.String'               
D                                             :'getBytes')                      
D string          s               o   class(*java:'java.lang.String')           
D bytes2          s             20a   varying                                   
   string = makestring('This is a test ');                                      
   string = setMyString(string);                                                
   bytes2 = getBytes(string);                                                   
   dsply bytes2;                                                                
14. Compile the program 
16. call the RPGLE program
When i first compiled and ran this program by doing CALL TESTJAVA, I got my 
output as "This is a test prog". 
But after that whenever i CALL TESTJAVA , I get an error:

Java exception received when calling Java method (C G D F). 
Application error. RNX0301 unmonitored by TESTJAVA at statement 0000000021

Line 21 is the line which calls setMystring,i.e. 
string = setMyString(string)

If anyone can give me some pointers about the reason for this error it will be 
very helpful.

If you are not the intended recipient, please notify the sender by return email 
and then delete the message from your computer. The Skandia UK Group reserves 
the right to monitor e-mail communications through its networks.

No contract may be concluded on behalf of the Skandia UK Group by email.

Skandia Life Assurance (Holdings) Limited Skandia Life Assurance Company 
Limited Skandia MultiFUNDS Limited, Skandia Investment Management Limited.

Registered Nos: 1606702, 1363932, 1680071, 4227837, England
Registered Office: Skandia House, Portland Terrace, Southampton SO14
7EJ, United Kingdom

Royal Skandia Life Assurance Limited Registered No : 24916 Isle of Man
Registered Office: Skandia House, King Edward Road, Onchan, Isle of Man IM99 
1NU, British Isles

Skandia Life Assurance Company Limited, Skandia MultiFUNDS Limited, Skandia 
Investment Management Limited and Royal Skandia Life Assurance Limited are 
authorised and regulated by the Financial Services Authority for UK
investment business.


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