command line 'java' only works in the present working directory
I have compiled a test class Simple.class which does nothing but prints its name
public class Simple {
public static void main(String[] args) {
System.out.println("I'm a simple class!");
}
}
following is form the Bash Terminal, on Mac OS X:
G5:~/Java user$ ls
Simple.class
G5:~/Java user$ java Simple
I'm a simple class!
G5:~/Java user$ cd ..
G5:~ user$ java Java/Simple
Exception in thread "main" java.lang.NoClassDefFoundError: /Users/user/Java/Simple
-
it seems like the command line 'java' only works for me when the present working directory is the same as of the class I am trying to invoke?
why?

