File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes How to create a package? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to create a package?" Watch "How to create a package?" New topic

How to create a package?

ada choi

Joined: Sep 08, 2004
Posts: 16
i saw some of the JSR172 codes have this package line in the java codes. What is it for and how do i create a package file?

package example.serverscript.connector;
package example.serverscript.demo;
Balaji Loganathan
author and deputy

Joined: Jul 13, 2001
Posts: 3150
Moving this to Java in General forum.
Folks their may help you. Java in General

Spritle Software Blogs
Anamika Agarwal

Joined: Sep 07, 2004
Posts: 5
package example.serverscript.connector;
package example.serverscript.demo;

These lines indicate that the package example contains a package serverscript which contains another package connector.Similarly for second line the serverscript package contains a package called as demo.
To create a package file u have to write simply a line in the begining of the file.
package packageName;
And u have to create the directory with the packageName and keep ur file there.
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
Creating a package is as simple as declaring that a class, interface or enum definition belongs in a package as the first non-comment line of code in a source file.In this simple example, class Foo is a member of the fubar package.

You might like to take a look at the "Creating and Using Packages" lesson of Sun's Java Tutorial.

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
I agree. Here's the link:
subject: How to create a package?
It's not a secret anymore!