>>>>> "Alton" == Alton Goodman <[EMAIL PROTECTED]> writes:

    Alton> I'm attempting to learn java using the tutorial at
    Alton> java.sun.com.  My platform is Linux 2.0.30, a Slackware
    Alton> install.  I installed jdk1.1.6v4a per the instructions in
    Alton> the README file.  I haven't set the CLASSPATH env variable.

    Alton> So I wrote a program Date.java and placed it in a package
    Alton> named packages.  packages is a subdirectory in my home
    Alton> directory.  Here is a snippet: 
        [...]

    Alton> BTW, Date.java does have a constructor and an accessor
    Alton> function.  I compile Testdate.java using: javac -classpath
    Alton> .:~/:/opt/jdk1.1.6v4a/lib/classes.zip Testdate.java

    Alton> The compile executes without warnings or errors.  But when
    Alton> I attempt to run the app using: java -classpath
    Alton> .:~/:/opt/jdk1.1.6v4a/lib/classes.zip Testdate.class
                                                         ^^^^^^
You have to give the classname, not the filename, so omit the .class
and everything will be fine.

    Alton> java complains that it cannot find Testdate.class.


Another hint (this is the easy way for the same effect):

I assume your directory structure is like this:

someDirectory/packages/Date.java
someDirectory/TestDate.java

(1) go into someDirectory and type 

javac packages/Date.java

and you'll get

someDirectory/packages/Date.java
someDirectory/packages/Date.class
someDirectory/TestDate.java

(2) go into someDirectory and type

javac TestDate.java

and you'll get

someDirectory/packages/Date.java
someDirectory/packages/Date.class
someDirectory/TestDate.java
someDirectory/TestDate.class

(3) run it with

java TestDate

You can even skip step (1) and you get the same results.

Ulli

BTW: Maybe we should concentrate on the "-linux" aspect of this
mailing list. It seems to turn slowly into a high-volume java-newbie
list.

-- 
ETH Zentrum, IFW B43, CH-8092 Zürich
Phone +41-1-63 27393 // FAX +41-1-63 21172

Reply via email to