CLASSPATH Environment Variable

Q

If a class is located in a package, what do you need to change in the OS environment to be able to use it?

✍: FYIcenter

A

You need to add the directory or the jar file that contains the package 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\fyicenter\hr\Employee.java. In this case, you need to add c:\dev to the variable CLASSPATH.

2007-03-03, 5056👍, 0💬