In Eclipse, all code—Java or otherwise—has to go into a
project
, and creating Eclipse projects is a
basic skill. Projects organize
your
files, classes, libraries, and exports. Over the next few recipes,
we’re going to create a Java project that will use
the code you see in Example 1-1 to display some
simple text, “Stay cool.”
Tip
Creating a Java project is a basic skill, and this chapter is all about basic skills. However, there’s much more that we don’t have space for here. For additional details on creating Java projects, see Chapter 3 and Chapter 4.
To get started, create a new Java project by selecting File→ New→ Project in Eclipse, and then open the New Project dialog, shown in Figure 1-5.
We want to create a Java project, so select Java
in the left pane and Java
Project
in the right pane. Click Next, and in the
next dialog name the project FirstApp
, as shown in
Figure 1-6.
Click Finish to finish creating the project. (If you click Next, additional options for creating projects appear in the dialog that opens, but this chapter deals with basic Eclipse skills; you can learn more about project creation options in Chapter 3.)
If you’ve opened Eclipse for the first time and/or the Resource perspective is the only perspective open, Eclipse will ask you if you want to switch to the Java perspective, as shown in Figure 1-7. Click Yes.
After this new project, FirstApp
, is created,
it’s opened in the Java perspective.
We’ve already discussed perspectives informally, but
now that we’re about to work with them directly
we’ll take a more in-depth look in the next two
recipes. We’ll continue developing the code for this
example in the recipes that follow.
Recipe 1.8 on creating a Java class; Chapter 1 of Eclipse (O’Reilly).
Get Eclipse Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.