Difference between revisions of "Java/C2/Getting-started-Eclipse/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with ''''Author''' : Bhairav Prasad Katipalli '''Script Title''' : Getting Started with Eclipse IDE '''Keywords''' : Eclipse, IDE. {| style="border-spacing:0;" | style="border:0.0…')
 
 
Line 33: Line 33:
  
  
* Create project in eclipse and class
+
* How  to Create project add a  class in Eclipse
* How to write java source code and
+
* How to write a java source code and
 
* How to run program in Eclipse
 
* How to run program in Eclipse
  
Line 60: Line 60:
  
  
| style="border:0.035cm solid #000000;padding:0.097cm;"| To follow this tutorial you need to have  
+
| style="border:0.035cm solid #000000;padding:0.097cm;"| To follow this tutorial you must have  
  
 
* Eclipse installed on your system.
 
* Eclipse installed on your system.
Line 90: Line 90:
  
  
| style="border:0.035cm solid #000000;padding:0.097cm;"| We get a '''Workspace Launcher''' dialog box.
+
| style="border:0.035cm solid #000000;padding:0.097cm;"| We have a '''Workspace Launcher''' dialog box.
  
  
A workspace is a location where all your project realated data and your eclipse related files are stored.
+
A workspace is a location where all the  project realated data and the eclipse related files are stored.
  
  
Line 110: Line 110:
 
|-
 
|-
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| Hover the mouse over the '''Welcome Page.'''
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| Hover the mouse over the '''Welcome Page.'''
| style="border:0.035cm solid #000000;padding:0.176cm;"| We have the '''Welcome to Eclipse''' page.  
+
| style="border:0.035cm solid #000000;padding:0.176cm;"| and  We have the '''Welcome to Eclipse''' page.  
  
 
|-
 
|-
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| Click on''' Workbench'''
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| Click on''' Workbench'''
| style="border:0.035cm solid #000000;padding:0.176cm;"| Click '''Workbench''' located at the top-right corner of the page.  
+
| style="border:0.035cm solid #000000;padding:0.176cm;"| Click '''Workbench''' which is  at the top-right corner of the page.  
  
 
|-
 
|-
 
| style="border:0.035cm solid #000000;padding:0.176cm;"|  
 
| style="border:0.035cm solid #000000;padding:0.176cm;"|  
| style="border:0.035cm solid #000000;padding:0.176cm;"| We have Eclipse IDE. Now let us add a project.
+
| style="border:0.035cm solid #000000;padding:0.176cm;"|And here  we have Eclipse IDE. Now let us add a project.
  
 
|-
 
|-
Line 172: Line 172:
 
|-
 
|-
 
| style="border:0.035cm solid #000000;padding:0.176cm;"|  
 
| style="border:0.035cm solid #000000;padding:0.176cm;"|  
| style="border:0.035cm solid #000000;padding:0.176cm;"| Here we have the project. Now let us add a class to the project.
+
| style="border:0.035cm solid #000000;padding:0.176cm;"| Here we haveeclipse IDE in the project. Now let us add a class to the project.
  
 
|-
 
|-
Line 178: Line 178:
  
 
'''New -> Class'''
 
'''New -> Class'''
| style="border:0.035cm solid #000000;padding:0.176cm;"| Right click on the project, '''new '''and select '''class'''
+
| style="border:0.035cm solid #000000;padding:0.176cm;"| Right click on the project, '''new ''' select '''class'''
  
 
|-
 
|-
Line 192: Line 192:
 
|-
 
|-
 
| style="border:0.035cm solid #000000;padding:0.176cm;"|  
 
| style="border:0.035cm solid #000000;padding:0.176cm;"|  
| style="border:0.035cm solid #000000;padding:0.176cm;"| For now, let us leave it as public.
+
| style="border:0.035cm solid #000000;padding:0.176cm;"| For now,   leave it as public.
  
 
|-
 
|-
Line 200: Line 200:
 
|-
 
|-
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| Select '''public static void main'''
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| Select '''public static void main'''
| style="border:0.035cm solid #000000;padding:0.176cm;"| Notice the options for method stubs. For now, we’ll be using '''public static void main'''
+
| style="border:0.035cm solid #000000;padding:0.176cm;"| And in the list of stubs select the option  that says'''public static void main'''
  
 
|-
 
|-
Line 228: Line 228:
 
|-
 
|-
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| click on Outline portlet
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| click on Outline portlet
| style="border:0.035cm solid #000000;padding:0.176cm;"| And the Outline portlet that gives a hierarchy of the project.
+
| style="border:0.035cm solid #000000;padding:0.176cm;"| And the Outline portlet it gives a hierarchy of the project.
  
 
|-
 
|-
Line 236: Line 236:
 
|-
 
|-
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| minimize the portlets
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| minimize the portlets
| style="border:0.035cm solid #000000;padding:0.176cm;"| They can be minimized by clicking the minimize button
+
| style="border:0.035cm solid #000000;padding:0.176cm;"| They can also be minimized by using the minimize button
  
 
|-
 
|-
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| restore the portlets
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| restore the portlets
| style="border:0.035cm solid #000000;padding:0.176cm;"| They can also be restored by clicking the restore button.
+
| style="border:0.035cm solid #000000;padding:0.176cm;"| They can   be restored by using the restore button.
  
 
|-
 
|-
Line 256: Line 256:
 
|-
 
|-
 
| style="border:0.035cm solid #000000;padding:0.176cm;"|  
 
| style="border:0.035cm solid #000000;padding:0.176cm;"|  
| style="border:0.035cm solid #000000;padding:0.176cm;"| Now let us add the print statement here.
+
| style="border:0.035cm solid #000000;padding:0.176cm;"| Now let us add a print statement here.
  
 
|-
 
|-
Line 268: Line 268:
 
|-
 
|-
 
| style="border:0.035cm solid #000000;padding:0.097cm;"|  
 
| style="border:0.035cm solid #000000;padding:0.097cm;"|  
| style="border:0.035cm solid #000000;padding:0.097cm;"| Save the file by clicking on '''File '''and select '''Save'''
+
| style="border:0.035cm solid #000000;padding:0.097cm;"| Save the file by clicking '''File '''and select '''Save'''
 
+
 
|-
 
|-
 
| style="border:0.035cm solid #000000;padding:0.176cm;"|  
 
| style="border:0.035cm solid #000000;padding:0.176cm;"|  
| style="border:0.035cm solid #000000;padding:0.176cm;"| Alternatively, you can use the shortcut '''Control S'''
+
| style="border:0.035cm solid #000000;padding:0.176cm;"| Alternatively, you can use the shortcut '''Control S''' also
  
 
|-
 
|-
 
| style="border:0.035cm solid #000000;padding:0.176cm;"|  
 
| style="border:0.035cm solid #000000;padding:0.176cm;"|  
| style="border:0.035cm solid #000000;padding:0.176cm;"| To run this program, right click on the '''editor''', go to '''run as''' and select '''java application'''
+
| style="border:0.035cm solid #000000;padding:0.176cm;"| To run this program, right click on the '''editor''', go to '''run as''' and select '''java applicationapplication'''
  
 
|-
 
|-
 
| style="border:0.035cm solid #000000;padding:0.176cm;"|  
 
| style="border:0.035cm solid #000000;padding:0.176cm;"|  
| style="border:0.035cm solid #000000;padding:0.176cm;"| We see that if somethng is printed, the '''Output''' portlet shows the output.
+
| style="border:0.035cm solid #000000;padding:0.176cm;"| We see that if somethng is printed, the '''Output''' console  shows the output.
  
 
|-
 
|-
 
| style="border:0.035cm solid #000000;padding:0.176cm;"|  
 
| style="border:0.035cm solid #000000;padding:0.176cm;"|  
| style="border:0.035cm solid #000000;padding:0.176cm;"| If our code had problems, they would have been shown on the '''Problems''' portlet
+
| style="border:0.035cm solid #000000;padding:0.176cm;"| If our code had problems, the  problem would have been shown on the '''Problems''' portlet
  
 
|-
 
|-
Line 300: Line 300:
  
  
| style="border:0.035cm solid #000000;padding:0.176cm;"| In this tutorial, we have learnt how to create project in eclipse and a class to it. How to Write a java source code and how to run a java program in Eclipse.
+
| style="border:0.035cm solid #000000;padding:0.176cm;"|This brings us to the end of this tutorials. In this tutorial, we have learnt how to create a project in eclipse and a class to it. How to Write a java source code and how to run a java program in Eclipse.
  
 
|-
 
|-
Line 315: Line 315:
  
  
| style="border:0.035cm solid #000000;padding:0.097cm;"| * create a new project, by the name '''Display'''
+
| style="border:0.035cm solid #000000;padding:0.097cm;"| AS an assignment for this tutorial * create a project, by the name '''Display'''
* create a new class file under '''Display''' project, by the name '''Welcome '''
+
* and add a class to the '''Display''' project, by the name '''Welcome '''
  
  

Latest revision as of 13:19, 7 May 2013

Author : Bhairav Prasad Katipalli

Script Title : Getting Started with Eclipse IDE

Keywords : Eclipse, IDE.


Visual cue Narration
Slide 1

Welcome Slide

Welcome to the spoken tutorial on Getting started with Eclipse.
Slide 2

Learning Objectives


By the end of this tutorial you should be able to:

  • Create project and class
  • Write a java source code using Eclipse
  • Compile the source code and
  • Execute a java program


In this tutorial we are going to learn


  • How to Create project add a class in Eclipse
  • How to write a java source code and
  • How to run program in Eclipse


Slide 3

Software Versions

For this tutorial we are using:
  • Ubuntu 11.10,
  • Eclipse 3.7


Slide 4

Pre-requisites


  • Eclipse and JDK are installed in your System
  • If not, please go through the tutorials on these topics available at our website[1]http://spoken-tuitorial.org


To follow this tutorial you must have
  • Eclipse installed on your system.
  • If not, for relevant tutorial please visit our website as shown.


Slide 5

Introduction to Eclipse

Eclipse is an Integrated Development Environment


It is a tool on which one can write, debug and run java programs easily.

Press Alt + F2

Type eclipse

Now let us open Eclipse.


Press Alt F2 and in the dialog box, type eclipse and hit enter.

Hover the mouse over Eclipse Workspace Launcher


We have a Workspace Launcher dialog box.


A workspace is a location where all the project realated data and the eclipse related files are stored.


There is already a location which is the default location.


Using the browse feature, a different directory can also be selected.


For now let us proceed with the default directory.

Click on OK. Click OK to proceed.
Hover the mouse over the Welcome Page. and We have the Welcome to Eclipse page.
Click on Workbench Click Workbench which is at the top-right corner of the page.
And here we have Eclipse IDE. Now let us add a project.
File -> New -> Project go to File


New and select Project

In the list of projects, select Java Project
Click Next Also note that, for most of our tutorials, we will be using java project. Click Next
Type EclipseDemo in the name field In the project name, type EclipseDemo
Notice an option that says use default location
if this option is selected, all the EclipseDemo project data is stored in the default workspace.
If it is unselected, using the browse feature, a different location can also be selected.

For now we’ll use the default location.

Click Finish click Finish located at the bottom right corner of the Wizard.
Select the checkbox and click Yes We get the Open Associated Perspective dialog box.


A perspective refers to the way items are arranged in Eclipse.


The dialog box is suggesting a perspective that is suited for Java development.


Select remember my decision and click Yes.

Here we haveeclipse IDE in the project. Now let us add a class to the project.
Right click on the project,

New -> Class

Right click on the project, new select class
Type DemoClass in name field In the class name, give DemoClass
Notice that in modifiers, we have two options,

public and default

For now, leave it as public.
The other options will be discussed in subsequent tutorials.
Select public static void main And in the list of stubs select the option that sayspublic static void main
The other options will be discussed in subsequent tutorials.
click Finish click Finish located at the bottom right corner of the wizard.
Here we have the class file.
Notice that there are a lot of partitions. These are called portlets.
click on Package Explorer portlet We have the Package Explorer portlet that behaves like a File Browser
click on Editor portlet We have the Editor portlet in which we write the code.
click on Outline portlet And the Outline portlet it gives a hierarchy of the project.
resize the portlets Each portlet can also be resized
minimize the portlets They can also be minimized by using the minimize button
restore the portlets They can be restored by using the restore button.
minimize other portlets Now let us minimize other portlets and focus on the Editor.
As we can see, there is already some code, Eclipse has generated for us.
The code generated here depends on the options we select, while creating the class.
Now let us add a print statement here.
System.out.println(“Hello Eclipse”); Type System.out.println(“Hello Eclipse”).
Add a semicolon at the end of the statement.
Save the file by clicking File and select Save
Alternatively, you can use the shortcut Control S also
To run this program, right click on the editor, go to run as and select java applicationapplication
We see that if somethng is printed, the Output console shows the output.
If our code had problems, the problem would have been shown on the Problems portlet
Here is how you write and run a Java program in Eclipse
Exit the Eclipse window and show Slide window


Slide 6

Summary


This brings us to the end of this tutorials. In this tutorial, we have learnt how to create a project in eclipse and a class to it. How to Write a java source code and how to run a java program in Eclipse.
Slide 7

Assignment


  • create a new project, name it as Display
  • create a new class file, name it as Welcome and
  • print output statement as Welcome to Eclipse
  • create another class file, name it as ThankYou and
  • print output statement as Thank You for visiting Eclipse


AS an assignment for this tutorial * create a project, by the name Display
  • and add a class to the Display project, by the name Welcome


Slide 8

About the Spoken Tutorial Project


  • It summarises the Spoken Tutorial project
  • If you do not have good bandwidth, you can download and watch it


For more information on the Spoken Tutorial Project, watch the video available at the following link
  • It summarises the Spoken Tutorial project
  • If you do not have good bandwidth, you can download and watch it


Slide 9

Spoken Tutorial Workshops


The Spoken Tutorial Project Team

  • Conducts workshops using spoken tutorials
  • Gives certificates for those who pass an online test
  • For more details, please write to contact@spoken-tutorial.org


The Spoken Tutorial Project Team


  • Conducts workshops using spoken tutorials
  • Gives certificates for those who pass an online test
  • For more details, please write to contact at spoken hyphen tutorial dot org


Slide 10

Acknowledgement


  • Spoken Tutorial Project is a part of the Talk to a Teacher project
  • It is supported by the National Mission on Education through ICT, MHRD, Government of India
  • More information on this Mission is available at


* Spoken Tutorial Project is a part of the Talk to a Teacher project
  • It is supported by the National Mission on Education through ICT, MHRD, Government of India
  • More information on this Mission is available at
  • spoken hyphen tutorial dot org slash NMEICT hyphen Intro


Slide 11

About the contributor


  • This tutorial has been contributed by TalentSprint
  • Thanks for joining


* This tutorial has been contributed by TalentSprint
  • Thanks for joining.


Contributors and Content Editors

Chandrika, Sneha