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





Hi Mike:

I have put System.out.println at the point of
the email, but they don't print unless I run it in WDSC.


This piece of code will redirect stderr and stdout to files of your
choice (be sure to set stdoutPath and stderrPath to valid paths):

static PrintStream pError;
static PrintStream pOut;
static final String stdoutPath = "wherever";
static final String stderrPath = "wherever";
.
.
try{
pOut = new PrintStream(new BufferedOutputStream
(new FileOutputStream( stdoutPath, true)),true);
System.setOut(pOut);
pError = new PrintStream(new BufferedOutputStream
(new FileOutputStream( stderrPath, true)),true);
System.setErr(pError);
} catch (FileNotFoundException fnfe){
fnfe.printStackTrace();
System.exit(0);
}

Before ending the program try to flush the streams to make sure
everything is written to the file, otherwise some of the output could be
lost.

pOut.flush();
pError.flush();

This snippet of code will dump the System properties and show you what
is in the classpath:

System.getProperties().list(System.out);

The program still runs, but it doesn't appear to be hitting the email
piece.

Classloader may be failing, the exception is trapped and sent to stdout.


-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx
[mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Smith, Mike
Sent: Thursday, October 23, 2008 10:04 AM
To: Java Programming on and around the iSeries / AS400
Subject: Classpath issues- I think.

I always seem to have trouble with this.

I have a java program that I have been running for quite a while. I
have just made changes to it, to email me in the event of a problem. It
works fine in WDSC, but when I export it and run it, then no email. I
have added the mail.jar and activation to the folder and changed my
classpath, but still no luck.

Initially I had this
P:\engineering\iseriesjava. - this contained jt400.jar and my .bat file
containing the following line
java -cp
P:\\engineering\mercury\iseriesjava;P:\engineering\mercury\iseriesjava\j
t400.jar mercury.MercTest

All of the java code in folder mercury.

So after changine MercTest, I added mail.jar and activation.jar to
P:\enginnering\iseriesjava
And changed the .bat file to look like
java -cp
P:\\engineering\mercury\iseriesjava;P:\engineering\mercury\iseriesjava\j
t400.jar;P:\engineering\mercury\iseriesjava\mail.jar;P:\engineering\merc
ury\iseriesjava\activation.jar mercury.MercTest

The program still runs, but it doesn't appear to be hitting the email
piece.

I'm not sure how to fix this. Is there a way for me to debug the java
program outside of WDSC? I have put System.out.println at the point of
the email, but they don't print unless I run it in WDSC.

Mike

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.