8/3/2019 Eclipse First Project Tutorial
1/5
8/3/2019 Eclipse First Project Tutorial
2/5
Java Courses Eclipse First Project Tutorial Page 2 of 5
Source tabno changes. Note that Java source code
files will be in the src/javasubfolder.
Note that the compiledclass
files will be under thebuild/eclipse/classessubfolder.
Projects tabnochanges.
Libraries tabnochanges.
This is where user-definedlibraries are specified inmore complex projects.
Order and Export tabnochanges.
Press Finish to complete
the project setup wizard.
Copyright 2004-2011, Programix Inc.
8/3/2019 Eclipse First Project Tutorial
3/5
Java Courses Eclipse First Project Tutorial Page 3 of 5
Create a Class Right-click on the src/java
folder and then selectNew/Class.
Enter the package name:
com.abc.hello
Enter the classname:
HelloEclipseWorld
Press Finish.
Copyright 2004-2011, Programix Inc.
8/3/2019 Eclipse First Project Tutorial
4/5
Java Courses Eclipse First Project Tutorial Page 4 of 5
Edit the Java Source File Type in the contents of the
source file.
Ifyou want to, you can use
existing code templates andContent Assistto help writethe code. In this case, typemain,
then Ctrl+Space to activate Content Assist. Select the first item (main main method) to have themain method written for you
from a template.
Next, type sysout, then Ctrl+Space toactivate Content Assist.
Select the first item (sysout print to
stdout) to have System.out.println();written for you from a template.
To see more of the templates that areavailable, go to Windows/Preferences. Then go into Java/Editor/Templates. You canalso create your own templates to expand the power!
The completed contents ofHelloEclipseWorld.java should be:
package com.abc.hello;
public class HelloEclipseWorld {
public static void main(String[] args) {System.out.println("Hello Eclipse World!!!");}
}
Copyright 2004-2011, Programix Inc.
8/3/2019 Eclipse First Project Tutorial
5/5
Java Courses Eclipse First Project Tutorial Page 5 of 5
Compilation To compile your Eclipseproject, use Ctrl+B (menus: Project/Build All). Any compilation problems will show up in the Problems tab at the bottom of the
screen. Double-clicking on a problem will open the associated file and jump to theoffending line of code.
When on the line with the error, the code canbe manually corrected orthe Quick Fixfeature can be used to make suggestions bypressing Ctrl+1 (menus: Edit/Quick Fix). Using Quick Fix, select the second
suggestion to correct the code:
Running the Java Application For the firstrun, you need to let Eclipse
know which of your classes should beused as the starting point (the classwith themain method). Right-click on the classname, select
Run/Java Application.
Forsubsequentruns, simply pressCtrl+F11 (menus: Run/Run LastLaunched). This step automatically:
Saves all modified files (prompted), Compiles modified source files, and Runs the application.
Copyright 2004-2011, Programix Inc.