This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
For the past few weeks I have been learning how to manipulate java and javac commands when using a command prompt (on windows). Being able to use the -d command has made cleaning up the directories when compiling so much easier. However one problem that I have run into is inheritance and placing class files in a separate directories. I'll give a visual explanation:
Say I have the directory structure of:
Bob extends Human.
Human and Bob are both under the package structure
I am currently situated inside the root directory, so to compile the human.java file and place it into the classes directory I would use the command:
This places the Human.class in said directory structure. (I know most of you know this but bare with me).
However when I try to compile the Bob.java file with the same command it fails and I get errors stating it cannot find the Human Object/Class. I know that if I compile both files at the same time it would work perfectly but this seems to be quite a long entry into a cmd prompt, and having to recompile over and over with a massive String of text would just become tedious. My two questions are:
Is there a simpler way of doing this?
Do I have to use/can I use multiple javac options when compiling my file?
I have scoured the internet for the past few days to get my head around this but can't quite find the right answer. I am grateful for any help!