Java packages


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Java packages

  1. #1
    Join Date
    Jan 2005
    Posts
    6

    Question Java packages

    Hi, I am new to java and was wondering if anyone could explain to me how java packages are mapped to the file system?

  2. #2
    Join Date
    May 2004
    Location
    Durham, UK
    Posts
    174
    Hi,

    the package to file system mapping is reasonably straightforward.

    Assume that the current directory is C:\Javadev

    take the package name, and for each . replace with a \ this gives you the directory structure.

    So if you compile the following class


    package com.JGRobinson;

    class Test
    {
    }


    When you compile it, it will create the Test.class file in

    C:\Javadev\com\JGRobinson

    note that for linux/unix case is important.

    a package uk.co.google would be compiled to a .class file in

    C:\Javadev\uk\co\google


    Hope this helps
    Graham

  3. #3
    Join Date
    Jan 2005
    Posts
    6
    That's great. Thanks a lot!

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