This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
It is awkward; you have to start compiling the file which has no dependencies on any other files in your package structure. It is the one farthest from the main method, which can be difficult to guess.
The class with the main method in will be compiled last. Slightly easier to guess which one.
Its not that bad, if a dependent class is on the source path the javac will find it and compile it. That said, I use Windows mostly and I usually just write a script called compile and call that from the command line, I keep all my class names listed in separate text file:
[ April 19, 2007: Message edited by: Garrett Rowe ]
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Joined: Dec 28, 2004
Its not that bad, if a dependent class is on the source path the javac will find it and compile it.
If you have any knowledge regarding how come this works please let me know i am very much curious to know about this.
You can otherwise set the CLASSPATH to the correct directory i.e.
probably your files in source are in good package structure.
How this works? Here it is
when you set the classpath to src, the javac or java uses them to find other classes. For this situation your file in pack2 will have the package statement as
when this statement is encountered it checks whether a folder named "com" exists or not. for this it checks all the paths set in the classpath variable. since our classpath is set, it find com and it finds samples etc.
And Miles to go before I sleep<br />And Miles to go before I sleep