473,386 Members | 1,786 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

java packages

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.....
Jul 17 '05 #1
1 2274
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

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Lem | last post by:
I get the error Exception in thread "main" java.lang.NoClassDefFoundError when I type java app2 in the command prompt. I've tried moving to the jre directory and typed java c:\app2\app2, but it...
133
by: Gaurav | last post by:
http://www.sys-con.com/story/print.cfm?storyid=45250 Any comments? Thanks Gaurav
47
by: Alan Brown | last post by:
As a newbie I would like to ask what the difference in application (not details) is between C++ and Java. In what situations would you use C++ in preference to Java and vice versa? I am not...
2
by: Kent Lewandowski | last post by:
hi all, Recently I wrote some stored procedures using java jdbc code (admittedly my first stab) and then tried to implement the same within java packages (for code reuse). I encountered...
5
by: TZESENG | last post by:
DECEMBER 13, 2005 . Editions: N. America | Europe | Asia | Edition Preference News Analysis By Steve Hamm Source: http://www.businessweek.com/technology/content/dec2005/tc20051213_042973.htm...
0
by: jaywak | last post by:
Just tried running some code on Linux (2.4.21-32.0.1.EL and Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)) and Windows XPSP2 (with Java HotSpot(TM) Client VM (build...
5
by: r035198x | last post by:
Setting up. Getting started To get started with java, one must download and install a version of Sun's JDK (Java Development Kit). The newest release at the time of writting this article is...
1
by: shalini jain | last post by:
Hi all, I am very new to java and have a very limited knowledge about this. i am stuck at one problem which is really druving me crazy.. The problem is : I have written a code wherein I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.