** This thread discusses the article: Java Journal: You've Got JavaMail **
Yes, you can call the JavaMail program from ILE RPG/CL using JAVA or RUNJVA command. In the example you might want to send the from, to, cc, bcc, attachments as parameters to the JavaMail Class/pgm. There are a couple of things to be aware of though. Those commands can only accept a parameter with a max size of 256. Also, when you use those commands you have to realize that a seperate JVM job will be submitted to whatever subsystem you're running them in. This can be an issue if you try to submit to a subsystem that will only allow you to run 1 job at a time. Another way is to call the java classes/methods directly from rpg. You have to be on release v5r1m0 or higher to use the Java Object data type though. This way another JVM job is not created when you call the classes/methods in the JavaMail API. There's a whole chapter devoted to this in the v5r1 ILE RPG Programmer's Guide. I think it's called rpg and eBusiness or something.
** This thread discusses the article: Java Journal: You've Got JavaMail **
export -s CLASSPATH='/java/source/:/java/jaf-1.0.2/activation.jar:/java/ja vamail-1.3/mail.jar' I am getting the following error Message htmlsendsample.java:2: Package javax.mail not found in import. import javax.mail.*; ^ htmlsendsample.java:3: Package javax.mail.internet not found in import. import javax.mail.internet.*; ^ htmlsendsample.java:4: Package javax.activation not found in import. import javax.activation.*; ^ 3 Eerrors I have JDK1.1.8 installed on my as/400
** This thread discusses the article: Java Journal: You've Got JavaMail **
Where are you trying to compile the class you created? In Qshell or via a command line using crtjvapgm?
** This thread discusses the article: Java Journal: You've Got JavaMail **
Right before you use javac to compile your class, type in "env" and ensure that your classpath variable looks like what you want it to.
** This thread discusses the article: Java Journal: You've Got JavaMail **
I'm on OS400 r4.5. I prefer to use the QSH command for running java programs over JAVA or RUNJVA from the command line. The reason being that JAVA and RUNJVA will display the QShell console if called by an interactive program, whereas the following will run 'silently': QSH CMD('java -classpath /java/hnz/:/java/jaf-1.0.2/activation.jar:/java/ javamail-1.3/mail.jar emailcsv johnv.thompson@xtra.co.nz mycsvfile.csv > / dev/null 2>&1') '> /dev/null' instructs QSH to redirect std output to file /dev/null (my equivalent of a trash file) and 2>&1 instructs QSH to redirect std error output to the same place as std output (ie wherever parameter 1 was redirected). Without these redirections to file, messages associated with running a java program would be displayed. I notice that when you run java programs this way without redirection, the QSH console displays messages from earlier executions of java programs. I'm inferring from this that calling QSH to run java programs is re-using the same JVM instance, and may be more efficient than using command line RUNJVA/JAVA. Can anyone confirm this?
Comment