Java Reference
In-Depth Information
* To change this template use File | Settings | File Templates.
*/
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
1.3.3
Building the project
Now that your class is finished, you can build the project. Building , in this case,
involves compiling the Java source into a class file, but the task can be a much
more complicated, multistage process for complex Java projects. Follow these
steps to build your project:
Select the Build | Make Project menu option (or, if you prefer, click the
Make Project button on the toolbar, or use the keyboard shortcut Ctrl+F9 ).
1
Because this is the first time you're building the project, IDEA recognizes
that the directory where the compiler's output classes should go doesn't
yet exist. Click Ye s to let IDEA create the output directory for you.
2
That's it! If you navigate your file system and look in that output directory, you'll
find a directory structure that matches the package structure in the Project tool
window, and the HelloWorld.class in the com.acme.helloworld package.
1.3.4
Running the project
HelloWorld is a special Java class in that it has a main() method, an entry point
that marks this class as a command-line executable. Consequently, you can
directly run and test this class to ensure its behavior operates as expected. Follow
these steps to run your class:
Select the Run | Edit Configurations menu option.
1
The Run/Debug Configurations window appears, allowing you to man-
age the different ways to execute and test code that you write. This sam-
ple is a simple Java application, so ensure that the Application tab is
selected. If it isn't, click it.
2
Click the plus button ( + ) to create a new Java application run configura-
tion. A new configuration is immediately added with the title Unnamed.
3
 
 
 
 
 
 
 
Search WWH ::




Custom Search