Re: Q: Java source and directory structure - 'standard way' ?

From: Missaka Wijekoon (mwijekoon_at_RemoveThis.villageEDOCS.com)
Date: 01/24/04


Date: Sat, 24 Jan 2004 00:11:43 GMT

I think this may be a difference in JDKs. I prefer that the package
source be in all one place and the JDK build the tree as it compiles.

  -Misk

FISH wrote:
> Ever have one of those days when you're not sure if it's you who's gone
> mad, or the rest of the world?
>
> I have an Open Source project on SourceForge for communication with YSMG
> - Yahoo's IM protocol. I keep the project source in three directories,
> based upon the code's function: one for the network API code itself, one
> for the support APIs (basic chat spam filtering, Swing models, rich text
> decoders, etc), and one for the test client built using the network API.
>
> When I compile I use the -d option on Sun's SDK... the compiler builds
> the necessary directory tree (if not already there from a previous build)
> and places the class files into it.
>
> One or two users have complained that the source is in the wrong direct-
> ories and it won't compile. One guy helpfully rearranged the source tree
> and mailed me a zip file - telling me this is the 'standard way' to store
> Java source.
>
> What they do is they build the package directory tree by hand, place
> their .java files into the appropriate directories, and then just
> "javac *.java" in each directory of the tree. The result is that, in
> the absense of a specified output directory, the class files end up
> right next to the source files - but this works because the source
> code directory structure has been created to mirror the package names.
>
> This isn't the first time I've seen this done - I've noted a programmer
> where I work does the same thing! And although it works, to me it is
> less than ideal. I have a hard time accepting that this is the 'standard
> way', for several reasons:
>
> 1) The compiler should be responsible for organising and creating *ALL*
> its output itself - this includes creating any directories which
> are needed for its representation of the code. The user should not
> need to work this out in advance and provide them.
>
> 2) With source and class files intermixed, packing up the source or
> creating a Jar becomes a major headache. Surely the output direct
> -ories should remain _pure_, containing only those files which form
> the package?
>
> 3) This scheme pre-supposes that Java compilers will always use direct-
> ories to model their package hierarchy - which might not always be
> the case.
>
> I can think of a handful of other reasons why I think this scheme is
> inferior, but I think I've already made my point...! :-) So, the
> question is... Is this *really* the 'standard way' (or conventional
> way) of holding Java source - or are all these coders just ignorant
> of the -d switch ???
>
>
> -FISH- ><>

-- 
========================================================================
Missaka Wijekoon (a.k.a. Misk)     mwijekoon@RemoveThis.villageEdocs.com
Sr. Software Engineer              http://www.villageEdocs.com
VillageEdocs
========================================================================


Relevant Pages

  • ANN: GtkAda contributions 2.1
    ... Custom cell renderers for tree view widget; ... Gtk.Tree_Model.Extension_Store package was added to provide derived ... Gtk.Directory_Browser package provides an implementation of caching tree ...
    (comp.lang.ada)
  • Re: morning update, using smart
    ... the fontconfig package. ... And that's all that gets my attention in that tree, ... fc-cache is yelping about. ... And the manpage for rpm doesn't seem to ...
    (Fedora)
  • Re: OT - A Letter to the sisterhood
    ... Agreed happily to sign for my Fed Ex package today. ... Immaculate laundry room. ... like under a tree or no ... Cheaper by the week, ...
    (rec.outdoors.rv-travel)
  • Re: GUI was Re: why Ada is so unpopular ?
    ... Doesn't MSVC++ and the MFC supply some kind of tree ... would return some kind of tree data structure? ... and it makes it darned attractive to a developer to use Ada ... assuming a "Directories" package is going to build data structures ...
    (comp.lang.ada)
  • Re: Class cant find another class in the same directory
    ... referring to the second class when I go to build it. ... If they belong to the same package there is no need to import anything. ... necessary class files relative to your current location. ... represented by the directory hierarchy my/path. ...
    (comp.lang.java.programmer)