wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes packages mechanics Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "packages mechanics" Watch "packages mechanics" New topic
Author

packages mechanics

Danny Ksomething
Greenhorn

Joined: Nov 17, 2001
Posts: 4
I'm just a beginner, but came across this packages subject, and it made mw curious: How does it work ? Does the compiler write some info in some "Registry like" file when i write the package statement ?
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Welcome to JavaRanch.
As a tip, if you do a search for "package" on this form, I'd bet you'll find plenty of information. The search page link is at the top-right of this page.
Otherwise, from Sun's Java Tutorial you might want to read the trail on Creating and Using Packages.
Good Luck.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Danny Ksomething
Greenhorn

Joined: Nov 17, 2001
Posts: 4
Well, i tried to folloow the tips, but havent found an answer.
u c, i'd like 2 know the Java platform handles packages. Not HOW TO work with them. I suceeded doing that.
Nandu Arni
Greenhorn

Joined: Jan 26, 2002
Posts: 8
When we specify a package in java, it physically creates a directory in the file system. The package structure is just like an ordinary file system. For example, a file called foo.java is placed in dir1/dir/2/dir3/foo.java is exactly similar to
package dir1.dir2.dir3
class foo
{
}
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Originally posted by Danny Ksomething:
Well, i tried to folloow the tips, but havent found an answer.
u c, i'd like 2 know the Java platform handles packages. Not HOW TO work with them. I suceeded doing that.

Well, continuing down the path I recommended, you'll come across the page Managing Source and Class Files which would seem to me to describe what you are curious about.
The package heirarchy is quite similar to the directory heirarchy on a harddrive. The individual class file knows what package it belongs to (more or less) - it got this information when it was created (compiled).
Note: When you compile a file, it is NOT by default placed in the proper directory according to its package; but you may be using an IDE that takes care of this dirty work automatically.
Good Luck.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: packages mechanics
 
Similar Threads
Logging Packages
Make call to phone with java + broadband connection?
logging on IBM werbsphere
Mandatory Packages in JSP File
writing XML