Packages


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: Packages

  1. #1
    Join Date
    Feb 2004
    Posts
    34

    Packages

    what does the "com." part of a package statement mean. For example com.programs.wow;
    www.saterasoft.cjb.net

    Come and play the games.....

  2. #2
    Join Date
    Feb 2004
    Posts
    541
    as far as i understand it, packages work somewhat like folders do. For example, java.util.* import all class files in the package named util, which is contained in a package named java.

  3. #3
    Join Date
    Mar 2004
    Posts
    635
    in other words, com is a folder name

  4. #4
    Join Date
    Feb 2004
    Posts
    808
    package names are recommended to be the reverse of the url where they may be found...

    for example if sun write a whizzbang component for java and they offer it for download at http://whizzbang.java.sun.com

    then they SHOULD package it like:

    package com.sun.java.whizzbang;

    BUT there are no restrictions.. because after all, package merely states "this file will be found at the stated path"

    so a file that has package com.sun.java.whizzbang should be found in the following path:

    com\sun\java\whizzbang\<files>

    AND, the "com" folder MUST be on your classpath.. so if your classpath is c:\myJavawork then the FULL path of the whizzbang suite must be:

    c:\myJavawork\com\sun\java\whizzbang\<files>

    otherwise, your "import com.sun.java.whizzbang.*" statement ina java source file, WONT work..


    i really really need to write a classpath tutorial..
    The 6th edict:
    "A thing of reference thing can hold either a null thing or a thing to any thing whose thing is assignment compatible with the thing of the thing" - ArchAngel, www.dictionary.com et al.
    JAR tutorial GridBag tutorial Inherited Shapes Inheritance? String.split(); FTP?

  5. #5
    Join Date
    Feb 2004
    Posts
    541
    as i've seen people mention before, you're working your way towards a book with these tutorials. Will we get discounts?

  6. #6
    Join Date
    Dec 2002
    Posts
    83
    Just a small add-on, the basing off URL is to help ensure unique names. It's very likely that a number of people/sources might create a class called say, StringUtility. A unique package name like com.reinkesm.utils.StringUtility keeps it seperate from a com.cjard.tutorial.StringUtility so if I wanted, I could reference both classes within my code.
    -- Steven

  7. #7
    Join Date
    Feb 2004
    Posts
    808
    Originally posted by mikeBarr81
    Will we get discounts?
    lol..

    bah, youth of today.. asking for discounts on a free thing
    The 6th edict:
    "A thing of reference thing can hold either a null thing or a thing to any thing whose thing is assignment compatible with the thing of the thing" - ArchAngel, www.dictionary.com et al.
    JAR tutorial GridBag tutorial Inherited Shapes Inheritance? String.split(); FTP?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center