DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
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!

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links