Java Reference
In-Depth Information
Edit pane
Output pane
F
IGURE
1.16
You can edit a program and run it in NetBeans.
1.11.3 Compiling and Running a Class
To run
Welcome.java
, right-click Welcome.java to display a context menu and choose
Run File
,
or simply press Shift
F6. The output is displayed in the Output pane, as shown in Figure 1.16.
The
Run File
command automatically compiles the program if the program has been changed.
+
You can edit, compile, run, and debug Java Programs using Eclipse.
Key
Point
The preceding section introduced developing Java programs using NetBeans. You can also
use Eclipse to develop Java programs. This section gives the essential instructions to guide
new users to create a project, create a class, and compile/run a class in Eclipse. For instruc-
tions on downloading and installing latest version of Eclipse, see Supplement II.D.
1.12.1 Creating a Java Project
Before creating Java programs in Eclipse, you need to first create a project to hold all files.
Here are the steps to create a Java project in Eclipse:
VideoNote
Eclipse brief tutorial
1. Choose
File
,
New
,
Java Project
to display the New Project wizard, as shown in Figure 1.17.
2.
Type
demo
in the Project name field. As you type, the Location field is automatically set
by default. You may customize the location for your project.
3. Make sure that you selected the options
Use project folder as root for sources and class
files
so that the .java and .class files are in the same folder for easy access.
4.
Click
Finish
to create the project, as shown in Figure 1.18.
1.12.2 Creating a Java Class
After a project is created, you can create Java programs in the project using the following steps:
1. Choose
File
,
Ne
w,
Class
to display the New Java Class wizard.
2. Type
Welcome
in the Name field.
Search WWH ::
Custom Search