1. package are actually files (JAR,WAR,EAR extensions and those are
actually zip files ) . In Example , if you open rt.jar (from the
directory jre/lib)
you will find folder tree int it. that is an example of package.
ex. com
|-sun
|-jdbc
to make a class become a member of package , you need to declare on the
first line of your .JAVA file
ex.
package com.sun.jdbc;
public class MyHelloClass{
...
}
2. Compiling a package is just a matter of creating zip file. with tree
of package in it.
and if you want to run a package, you must create a package by using
jar utility, which
can be used to write a metafile which contain the main class of your
jar.
and then you can run it
java -jar test.jar
3. classpath is an Environment variable. in Linux you can set it in
.BASHRC, and in windows XP you can set it in
My Computer->properties->advanced.
create an Enviroment Variable named CLASSPATH and write to the value
the locations of your jar files complete
ex. c:\jre\lib\rt.jar;c:\jasper\lib\jasperreport.jar;
and so on