File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes file organization (directory structure) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "file organization (directory structure)" Watch "file organization (directory structure)" New topic

file organization (directory structure)

ken brooks

Joined: Sep 09, 2001
Posts: 5
This is somewhat of a preference thing, but can anyone
post how they setup their directories for source and compilation.
/projects/myproject1/ main dir
/projects/myproject1/src source files
/projects/myproject1/resourse resource (image, config) files
something like that.. ?
where do you put your class files
how do you package everything if you are going to distribute
it all.
Jason Kretzer
Ranch Hand

Joined: May 31, 2001
Posts: 280
I generally put all class files in the root directory of the project. \projects\myProject\
I put any images together. \projects\myProject\Images\
I also group together text/config files. \projects\myProject\config\
The only text file I allow in my root directory of the project is the one I use for the manifest.

Jason R. Kretzer<br />Software Engineer<br />System Administrator<br /><a href="" target="_blank" rel="nofollow"></a>
ken brooks

Joined: Sep 09, 2001
Posts: 5
so when you compile you just compile everything to the
root dir?
Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
Hi Ken,
The following setup works well for me:
All the .java files have package names and are kept in their respective 'src' directory.
When compiling, start in 'javadev' and use 'javac -d . src\...'
The .class files end up in directories matching their package names. Note, the package names can be whatever you want; don't have to match the '\src\project\' names. And if you do a new version, ie 'src\project1\v1' you can just copy the original source over to the new directory; make your changes and compile. Don't have to change package names so if you mess things up it's easy to recompile your original and get back to working code.

Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
I agree. Here's the link:
subject: file organization (directory structure)
It's not a secret anymore!