Java Reference
In-Depth Information
to place it elsewhere (the default is fine for this illustration). When you're
finished, click Next .
You're now prompted to specify the name of the directory where all the
Java source files for your project are located. For a new project, you're
specifying a new directory in which to put new files. The default is src ,
which is fine for this example. A src directory will be created beneath the
module content root. Click Next to continue.
12
The last dialog prompts you to specify where the output from the com-
piler should be placed. When the source in src is compiled into classes,
this directory is where those class files will be stored. The default is classes
under the module content root, and this default is again fine for our
example. Click Finish to complete the New Project Wizard .
13
IDEA will take a moment to scan through and parse all the Java classes known to
your project (which, at the moment, are only the classes in the JDK ). Let's push
ahead with the project!
1.3.2
Making a Java class
We've laid the groundwork around the “Hello, World” project by defining where
the files will live. Now it's time to create your first class. The following steps walk
you through one of the many ways to create classes in IDEA .
For the purposes of this exercise, let's create a class called HelloWorld in the
com.acme.hello directory:
The toolbar on the left side of the window contains two tool window but-
tons, Project and Structure. These represent tool windows : secondary win-
dows within the interface that provide access and support for specific
tasks. Generally, the Project tool window permits you to view and control
your project, and the Structure tool window lets you view and maneuver
around the structure of the current file in the editor; we'll examine each
of the tool windows in greater depth in chapter 2. For now, click the
Project tool window button to open that tool window.
1
The Project tool window opens, docked to the left side of the main win-
dow. Within that window, you can see a tree control representing the
complex structure that is your project: its modules and its libraries. You
need to navigate down to the source directory you specified in the New
Project Wizard , because that's where your source code for new classes
2
 
 
 
 
 
 
Search WWH ::




Custom Search