Sunday, October 19, 2008

Managing Source and Class Files

This lesson obliquely answers a question not answered in the earlier lesson on creating packages. Quoting from the lesson: "Many implementations of the Java platform rely on hierarchical file systems to manage source and class files, although The Java Language Specification does not require this".

So in theory, it seems, you can put package members anywhere you like, but in practice it seems advisable to file them in an orderly way. If you use NetBeans, it will do the filing for you, with each project in a directory or folder and class files and source files in subdirectories or subfolders.

If you program by hand, this lesson recommends that you put package members in a folder which corresponds to the package name. It also suggests that (like NetBeans) you put your source files and compiled files into separate subfolders. This all seems very reasonable and sensible, but I still can't fathom why the information was not put up front in the lesson on creating packages.

And that concludes the Learning the Java Language trail.

But the lesson ends with a paragraph about setting the class path. And as my first Java Blog included a beef about the path instructions, before I start another trail, I shall revisit the path issue.

No comments: