Q12. If a class is located in a package, what do you need to change in the OS environment to be able to use it?
A. You need to add a directory or a jar file that contains the package directories to the CLASSPATH environment variable. Let's say a class Employee belongs to a package com.xyz.hr; and is located in the file c:\dev\com\xyz\hr\Employee.java. In this case, you'd need to add c:\dev to the variable CLASSPATH. If this class contains the method main(), you could test it from a command prompt window as follows: c:\>java com.xyz.hr.Employee
my question is why we have to put into classpath like c:\dev just because this will be in a classpath variable and we i type c:\>java com.xyz.hr.Employee
it will take c:\dev from variable
but in other case like i have develop class name "MyClass.java" and put in packages package c as c folder is in a/b/ so the final location of MyClass.java is d:\a\b\c\MyClass.java
but its not compiling if i comiple from d:
like D:\>javac a.b.c.MyClass.java nor it reading it...