Hello, I had been reading java from the book "Head first Java" for some time. But I had really had not paid attention to the way the code was compiled when i was readind core java for the past one and a half month. The way the code has been compiled left me confused as i started reading RMI in the book. I know that code is compiled on the command prompt.For instance, if i wrote a program by name "Hello" and saved it in a folder say, "jfiles" in the c drive, I compiled it as "c:\jfiles>javac Hello.java"
But the book shows a command prompt which dispays "% javac Hello.java". Besides, in the rmi chapter, to start the rmi registry, the DOS prompt merely displays "% rmiregistry" which did show any result, but when I wrote "start rmiregistry" under the folder in the DOS prompt where i had created the files, a seperate rmiregistry DOS prompt opened up. I'am facing problems in understanding the way the code is compiled in the book. Is the code being compiled on a windows DOS prompt or any other OS. What does the symbol "%" before every command interpret. I'am unable to proceed further in RMI. I'm sorry to ask you after coming halfway through the book. I shall be grateful if you can explain me clearly. Thanks in advance,
I believe the examples in that book are from a unix machine (they certainly aren't Windows). The % is just the command line prompt - the equivalent of the c:\jfiles> on your machine.
Joined: Oct 06, 2008
Thanks loads for your prompt reply. But don't they write codes in folders or directories in Unix (as you said). But don't they use folders and directories to store programs. How can the JVM decipher the location of the code if you don't show the path.
It isn't required to display the path on the command prompt. It is only for the help of the user who is typing. The computer "knows" which folder you are in and runs the command in that folder itself.
You can configure the command prompt on Mac to display the path as well. Most people don't do it. It's just a matter of taste. To know which directory you are presently in, you can use the 'pwd' command. It stands for 'present working directory'