Q:

Eclipse Project Compiling, Or Not?

I noticed that when I build even a very simple Java program in Eclipse, and I try to run it from the Terminal/Command Line and it gives me errors.  I noticed after some hunting around that I have to actually compile the .java file I created in Eclipse in the Terminal to create and run the application.  However, I can just save and run in Eclipse and get the same output (within eclipse).
I checked to see if I could build the project in Eclipse but the option to do so is greyed out.  So, how can Eclipse run it if it actually never gets compiled?

A:

Eclipse does compile it, otherwise it could not run it :-).
Eclipse generates normal .class files, just like javac. It puts them into its "build directory", which you set in the "build path" (or something - Eclipse not handy right now) dialog. By default its under /bin, I believe.
In principle, you can run your program in a terminal using these class files; you just need to set your CLASSPATH accordingly.
In practice, you would either run your program from inside Eclipse (which is for example easier to debug), or deploy your program (using e.g. Ant) to get some kind of installer or installation file, then install that and run it. That way you always run from a complete, correct installation.
Of course for small/simple programs, just running from Eclipse's class files is quite ok.

