On Sat, 16 Oct 2004 15:10:29 +0200, Mako Klaic wrote:
what is java package? (for exaple javax.servlet)
where are located package files?
what file type is a package?
im trying to include a package javax.servlet.http
i have intalled both J2SE and J2EE, bunt i can't compile a source with this
line of code:
import javax.servlet.http
or other.....
Use Google and search for java packages. Then work through any of the
tutorials.
Briefly, a package is a collection of (usually related) java class files
put into a jar file. The package name must show the directory structure
which has been built into the jar file holding the class files(it's a
simple zip file). A single jar file can hold several packages. What
happens when you import a package is that java looks at each jar file and
looks for a file which has the same name as the package plus .class at the
end it it is fully qualified, or a directory if you import .*;
So,
import javax.servlet.*;
Java looks in known locations for jar files. For each jar files it looks
for a directory javax/servlet, and if found, then the classes in the
package are made available.
with
import javax.servlet.http
Java looks through the jar files for the file javax/servlet/http.class
The usual place to put these package files is in your jre/lib/ext
directory, although you can use CLASSPATH to specify additional
directories.
There's a lot more to packages - look at the tutorials.
Tony