package, class path

package : group of related classes.

all classes must be in package.

the full name name of class includes package(java.lang.String)

rt.jar is compressed class files. ("rt" means runtime and when run the code or running the code. can unzip rt.jar via rt.exe)

  • package declaration

declared once in the first line.

classes in same source file are grouped in same package.

if there is no package declaration, it is going to be in unnamed package(default package).

  • bin folder : there are compiled class files(*.class). this is a root of package.

  • src folder : there are source files(*.java)

whenever run the code, go to specific folder every time? once you save it in class path, class path remove unnecessary work.

(save it)class path = package folder path

  • classpath :

-a path indicates class file(*.class). register package root to class path. =>even if you don't go to the file location, regardless current location, it executes file.

-add multiple paths using ';'

Last updated