I am getting a error in AS/400 while running a RPG program...I am trying to call a java method from my RPG program. I have added tw .jar file called mail.jar and activation.jar in the classpath varible in the ADDENVVAR....But still the error is saying that Class not found...
Additional Message Information
Message ID . . . . . . : RNQ0301 Severity . . . . . . . : 99
Message type . . . . . : Sender copy
Date sent . . . . . . : 12/31/10 Time sent . . . . . . : 12:01:08
Message . . . . : Java exception received when calling Java method (C G D
F). 开发者_StackOverflow中文版
Cause . . . . . : RPG procedure MAILERDEMO in program SAHOON1/MAILERDEMO
received Java exception "java.lang.NoClassDefFoundError:
javax/mail/Authenticator" when calling method "sendSimpleMail" with
signature
"(Ljava.lang.String;Ljava.lang.String;Ljava.lang.String;Ljava.lang.String;)V
" in class "demo.Mailer".
Recovery . . . : Contact the person responsible for program maintenance to
determine the cause of the problem.
Possible choices for replying to message . . . . . . . . . . . . . . . :
More...
Reply . . . : F
Please help me out.......
Thanks in adv...
your project need mail-api.jar in your classpath for javax/mail/Authenticator
Always make sure, you set the classpath before the Java-VM is started for your job. This is very important, because changing it later doesn't change anything, and it is not possible to start a new VM in the same job (there is currently no way to stop a running VM cleanly and start a new one on the AS/400). This is extremely confusing in an interactive job when you run multiple programs.
One way to handle this, is to write a CL-program that sets the classpath and then runs the program. Just remember, it not set for a program, it's set for the entire job, so you should call it via submit job then.
The moment the first java program (or method via ILE) is called in the job, the VM is started with with the current settings. So always set the classpath var to contain all jars/classes you'll need in any of your programs for that job. Also set the desired version of the VM then.
精彩评论