This week's book giveaway is in the OCAJP forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes creating a java package Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "creating a java package" Watch "creating a java package" New topic

creating a java package

Tex Abrey

Joined: Oct 04, 2002
Posts: 24
How do you go about creating a java package. I need to create a package for this class so that i can import it into a jsp page.
Greg Charles

Joined: Oct 01, 2001
Posts: 2865

Just put a line at the top of the class definition like:
package mypackage;
Voila, instant package. The package is usually reflected in the file structure, so you may want to put this file into something like src/mypackage/, and the class should definitely go in something like classe/mypackage/MyClass.class.
[ March 26, 2003: Message edited by: Greg Charles ]
It is sorta covered in the JavaRanch Style Guide.
subject: creating a java package