## Compiling/Building

The terms compile and build have very similar meanings. Both refer to the process of converting human-readable source code to machine-readable binary code. When we are programming in Java, compile generally refers to this process when it is performed on a single file. Build will generally refer to this process when it is performed on multiple files within one or more projects. The term "compile" is used rarely in the context of Gild and Eclipse. Every Java source file will be associated with a project in Gild. So, the term "build" is appropriate.

Your computer (or, in the context of Java, your virtual machine) does not understand source code. Before you can run any program, that program must be built at least once. Once a program is built, there will be two kinds of files associated with that program: the Java source files (*.java); and the bytecode class files (*.class). Your program will have to be built again whenever these two kinds of files get out of sync. This can happen for several reasons: edits, deletions, additions, etc.

To perform a build, follow these steps:1

1. In the Gild Resource View, select the project that you want to build.
2. Click the "Build Project [selected project]" button on the toolbar.

If there are no errors in your source code that prevent the build from completing, you should now be able to run your program.

1 Note: Eclipse uses the term "build" in a slightly different sense than we do here. In Eclipse, "build" typically refers to an "incremental build". That is, an Eclipse build will only compile the files that Eclipse knows need to be built. This kind of build will not always synchronize the files properly, however. To avoid this, when Gild makes reference to "build", we mean what Eclipse calls a "rebuild". Gild builds compile all the files in your project, not just some of them.

Previous | Next