Chapter 01: Building Blocks
1.4 Understanding Package Declarations and Imports

Understanding Package Declarations and Imports

Compiling and Running Code with Packages

javac command options

// Location of classes needed to *compile* the program
// 以下两个是黏在一起的,相亲相爱
-cp <classpath> 
-classpath <classpath>
 
// 当class-path被拆散时,我们需要两个dash在前面
--class-path <classpath>
 
// Directory in which to place generated class files
-d <dir>

java command options

// Location of classes needed to *run* the program
-cp <classpath>
-classpath <classpath>
--class-path <classpath>

Compile and run with one command