my grasp of this is a little shaky. please correct me if i'm wrong, but my understanding (and maybe my articulation will help others), is the following:
1- -cp statement essentially counter acts/accommodates the package path statement. this is because the package statement is a directive to look for .class files in the path stated in the package, starting in the current dir the file is being executed from. in order to compile from the command line, you need to set the -cp path to a dir that would allow the package path to be true, i.e.: E:\Programming\Java Passion\basic\10_classpath\homework\foodpackage \fruitpackage> java -cp ../../ foodpackage.fruitpackage.FoodMain 2- -cp is not necessary when running the 'java' command with a true package path. that is, if you run 'java' from two dirs above, the following is true; E:\Programming\Java Passion\basic\10_classpath\homework> java foodpackage.fruitpackage.FoodMain same as: E:\Programming\Java Passion\basic\10_classpath\homework> java -cp . foodpackage.fruitpackage.FoodMain i'm having a hard time conceptualizing a real world example or need for dealing with the class path. because the package statement must match the dir structure, changing the class path seems undesirable, and would require recompiling the .class file. thanks kindly, ooo.stephen -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/javaprogrammingwithpassion?hl=en
