0

我在运行 RPG 程序时遇到 AS/400 错误...我试图从我的 RPG 程序中调用 java 方法。我在 ADDENVVAR 的类路径变量中添加了名为 mail.jar 和 activation.jar 的 tw .jar 文件。但仍然错误是找不到类...

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

请帮帮我......

感谢您的建议...

4

2 回答 2

1

始终确保在为您的工作启动 Java-VM之前设置类路径。这一点非常重要,因为以后更改它不会改变任何东西,并且不可能在同一个作业中启动新的 VM(目前没有办法干净地停止正在运行的 VM 并在 AS/ 400)。当您运行多个程序时,这在交互式作业中非常令人困惑。

处理此问题的一种方法是编写一个设置类路径然后运行程序的 CL 程序。请记住,它不是为程序设置的,而是为整个作业设置的,因此您应该通过提交作业调用它。

在作业中调用第一个 java 程序(或通过 ILE 的方法)的那一刻,VM 以当前设置启动。因此,请始终将类路径 var 设置为包含您在任何程序中执行该作业所需的所有 jars/classes 。然后还要设置所需的 VM 版本。

于 2012-05-22T15:49:55.683 回答
1

你的项目在你的类路径中需要mail-api.jarjavax/mail/Authenticator

于 2010-12-31T11:19:09.870 回答