• Subject: RE: A newbie question.
  • From: "Fred Kulack" <kulack@xxxxxxxxxx>
  • Date: Mon, 29 Jan 2001 17:09:04 -0600
  • Importance: Normal


Ahh... It becomes clear to me. (mostly) 8-)

1) Your classpath must be the same when attempting to run as it was
when you successfully compiled.
Thus, you cannot expect to be able to add /etbjava/mail.jar to the
classpath just to get it to compile, then REMOVE /etbjava/mail.jar from
your classpath to run.
It just won't work, it's got to be there all the time.

2) When java says that it can't find msgsendsample, it's really complaining
about the fact that it can't find one of the classes that msgsendsample
uses.
This REALLY sucks, and its gotten me on more then one occasion.
You can use the -verbose option on the java command line to see
more detail about what is being loaded and what can't be found.

3) When you explicitly specify the -classpath parameter, you
are COMPLETELY wiping our the classpath that comes from
other places.

So, by specifying -classpath etbjava/mail.jar:/etbjava/activation.jar,
you are losing the classpath set in the environment variable.

I've never seen the jvm not be able to find java.* classes when
you explicitly specify the classpath like that, but that looks like
something you can take care of by using the classpath environment
variable instead.

=======
So, to fix it, I'd do the following:
1) in qshell, set the classpath to _everything_ you need.
I've shown you multiple commands here in an effort to make
it clear that you should only ADD to the classpath, and not remove
things that you've ever added before.
export -s
CLASSPATH=/QIBM/ProdData/HTTP/Public/jt400/lib/jt400.jar:$CLASSPATH
export -s CLASSPATH=/etbjava:$CLASSPATH
export -s CLASSPATH=/etbjava/mail.jar:$CLASSPATH
export -s CLASSPATH=/etbjava/activation.jar:$CLASSPATH

2) cd /etbjava
3) javac msgsendsample.java
4) if #3 fails, ADD required stuff to the classpath,
   and repeat #3 until it works. Don't remove any existing
   stuff.
   For example "export -s CLASSPATH=/etbjava/newjar.jar:$CLASSPATH"
5) After successful compile, run
   java msgsendsample
6) If #5 fails, retry with -verbose option, and
   look for things that you THINK aren't loading.
   You might see that they ARE loading.
   Don't know of a good way to actually identify
   the thing that caused the problem...



"Do you believe that my being stronger or faster has anything
 to do with my muscles in this place?" ... "Free your mind."
Laurence Fishburne as Morpheus in 'The Matrix'.

Fred A. Kulack  -  AS/400e  Java and Java DB2 access, Jdbc, JTA, etc...
IBM in Rochester, MN  (Phone: 507.253.5982   T/L 553-5982)
mailto:kulack@us.ibm.com   Personal: mailto:kulack@bresnanlink.net
AOL Instant Messenger: Home:FKulack  Work:FKulackWrk


"Buckingham, Ed" <Buckingham@AE.com>@midrange.com on 01/29/2001 02:43:19 PM

Please respond to JAVA400-L@midrange.com

Sent by:  owner-java400-l@midrange.com


To:   "'JAVA400-L@midrange.com'" <JAVA400-L@midrange.com>
cc:
Subject:  RE: A newbie question.



Fred:

I have tried everything that has been outlined so far.  But I am still
getting the error.  I am not sure where I am going wrong at.  Is it
possible
to step by step walk me through how to get this working?  I seem to be just
spinning my wheels.  This is what I am trying to do:

My library in QSH as /etbjava.  See below:


 AllNames.html           QPWXCPC                 dev
 CSDemo                  QPWXCRB                 etbjava
 EDI4XXPGM               QPWXCRBD                etc
 JavaMail                QPWXCSO                 home
 Manhattan Associates    QPWXCUM                 java
 Package-main.html       QPWXCWN                 log
 QCA400                  QPWXCWND                myjava
 QDBGSVR_CONTROL         QPWXGGA                 packages.html
 QDLS                    QPWXGGY                 scripts
 QFileSvr.400            QPWXGOS2                tipfrm
 QIBM                    QPWXGPC                 tmp
 QJAVA                   QPWXGRB                 tree.html
 QLANSrv                 QPWXGUM                 usr
 QNTC                    QSR                     wanda
 QOPT                    QSYS.LIB
 QOpenSys                QTCPTMM


In the library /etbjava I have the following objects:

activation.jar          msgsend.java            sendemail.java
mail.jar                msgsendsample.java      sendfile.class
msgsend.class           sendemail.class         sendfile.java

I have deleted the msgsendsample.class file that I once had there.  Now
when
I try to compile it I am getting errors.  So I guess the basic first step
is
going to be to compile the java program.  See below:

My CLASSPATH is as follows:

CLASSPATH=/QIBM/ProdData/HTTP/Public/jt400/lib/jt400.jar:/etbjava

I did a cd /etbjava so I will be compiling from the correct directory.

 javac msgsendsample.java

 msgsendsample.java:13: Package javax.mail not found in import.
 import javax.mail.*;
        ^
 msgsendsample.java:14: Package javax.mail.internet not found in import.
 import javax.mail.internet.*;
        ^
 msgsendsample.java:15: Package javax.activation not found in import.
 import javax.activation.*;
        ^
 3 errors

From here I see that it can not find my mail.jar & activation.jar files, so
I try the following:
javac -classpath /etbjava/mail.jar:/etbjava/activation.jar
msgsendsample.java

 msgsendsample.java:11: Package java.util not found in import.

 import java.util.*;

        ^

 msgsendsample.java:12: Package java.io not found in import.

 import java.io.*;

        ^

 msgsendsample.java:29: Superclass java.lang.Object of class msgsendsample
not found.
 public class msgsendsample {

              ^

 3 errors


Everything I try with the classpath just keeps getting worse.  Would
someone
take the time to walk me through, from STRQSH, to setting the classpath, to
compiling and running the program.  We could do this off the list or on.  I
am sure I am providing a lot of entertainment for the "seasoned veterns"
out
there :-), but I am determined to figure out what is going on, and how to
get this running.  Please help this sinking ship...

Thanks in advance...Ed
> -----Original Message-----
> From:   Fred Kulack [SMTP:kulack@us.ibm.com]
> Sent:   Monday, January 29, 2001 2:09 PM
> To:     JAVA400-L@midrange.com
> Subject:     RE: A newbie question.
>
>
> Hmm.... I'm thinking you may be incorrectly
> representing your environment to us, because
> what you've shown us so far is correct.
>
> A couple of things that are a little more esoteric
> that could be related:
>
> Your class name inside the msgsendsample.java file is
> correctly cased isn't it? I.e. there's not something like
> class MsgSendSample
> inside the msgsendsample file is there?
>
> You did use BINARY ftp to put those parts up
> to the AS/400 right?
> i.e. they are tagged as ascii (CCSID 819) when you look
> at them with WRKLNK '/etbjava' and use option 8 on
> them.
>
> Did you try to use javac from qshell on the
> msgsendsample.java source code or just
> run it from there.
>
> Did you try to use the JAVA CL command
> from the AS/400 command line and manually put
> in the classpath on the keyword?
>
>
> "Do you believe that my being stronger or faster has anything
>  to do with my muscles in this place?" ... "Free your mind."
> Laurence Fishburne as Morpheus in 'The Matrix'.
>
> Fred A. Kulack  -  AS/400e  Java and Java DB2 access, Jdbc, JTA, etc...
> IBM in Rochester, MN  (Phone: 507.253.5982   T/L 553-5982)
> mailto:kulack@us.ibm.com   Personal: mailto:kulack@bresnanlink.net
> AOL Instant Messenger: Home:FKulack  Work:FKulackWrk
>
> +---
> | This is the JAVA/400 Mailing List!
> | To submit a new message, send your mail to JAVA400-L@midrange.com.
> | To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
> | To unsubscribe from this list send email to
> JAVA400-L-UNSUB@midrange.com.
> | Questions should be directed to the list owner: joe@zappie.net
> +---
+---
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net
+---



+---
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net
+---

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