The Java VM is expecting to find the Foo class in a subdirectory call
foobar.  To solve this problem go to the directory ../foobar and try "java
foobar.Foo" .  This is essentially telling the JVM that you wish to run the
class file "Foo" in package "foobar".

Happy hacking,
peter


        -----Original Message-----
        From:   Roland Silver [SMTP:[EMAIL PROTECTED]]
        Sent:   Saturday, September 11, 1999 6:57 PM
        To:     [EMAIL PROTECTED]
        Subject:        package problem

        I have a problem with packages that has me stumped. I've boiled it 
        down to two simple classes, defined in Foo.java and Bar.java; both 
        are in the directory /home/rollo/Java/foobar on my i386 Linux
machine.

        //Foo.java
        package foobar;
        import java.util.*;
        public class Foo {
           public Foo() {
             Bar bar = new Bar();
           }
           public static void main(String[] args) {
             System.out.println("Foo here");
           }
        }

        //Bar.java
        package foobar;
        public class Bar {
           public Bar() {
             Foo foo = new Foo();
           }
        }

        Current directory is /home/rollo/Java/foobar, and
        CLASSPATH specifies the following three paths:
           /usr/local/jdk117_v3/lib/classes.zip
           /home/rollo/TIJ/exercises
           /home/rollo/Java

        The command
           javac Foo.java
        compiles OK, as does
           javac Bar.java
        putting Foo.class and Bar.class in the foobar directory, but
           java Foo
        complains:
           Can't find class Foo

        I'd really appreciate it if someone can help me with this problem!
        * What am I doing wrong?
        * How do I fix it?

        I am running Blackdown JDK version 1.1.7-V3 on an i386 machine under

        Red Hat Linux 6.0.

        -- Roland Silver <[EMAIL PROTECTED]>


        
----------------------------------------------------------------------
        To UNSUBSCRIBE, email to [EMAIL PROTECTED]
        with a subject of "unsubscribe". Trouble? Contact
[EMAIL PROTECTED]


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to