Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
10 views

Eclipse_IDE_Java_Programming_Style_Guidelines_and_Documentation

Uploaded by

amyavi0906
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Eclipse_IDE_Java_Programming_Style_Guidelines_and_Documentation

Uploaded by

amyavi0906
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

Eclipse IDE, Java Programming Style

Guidelines and Documentation

Department of Computer Science and Engineering, ITER


Siksha ’O’ Anusandhan (Deemed to be University), Bhubaneswar, Odisha, India.

1 / 29
Contents I

1 JDK Installation

2 Eclipse download

3 Eclipse IDE

4 Java Programming Style Guidelines

5 Documentation Style

2 / 29
JDK Installation

In a browser, go to the Java SE Development Kit Downloads page:


https://www.oracle.com/in/java/technologies/javase-
downloads.html

Click Accept License Agreement. Under the Download menu, click


the Download link that corresponds to the .exe for your version of
Windows.

To run the JDK installer Start the JDK installer by double-clicking


the installer’s icon or file name in the download location and follow
the instructions provided by the Installation wizard.

3 / 29
JDK Installation

4 / 29
JDK Installation

5 / 29
JDK Installation

6 / 29
Eclipse download

In a browser, go to https://www.eclipse.org/downloads/

7 / 29
Eclipse download

Click on ’Download Packages’. Select appropriate file in ’Eclipse IDE


for Java Developers’.

8 / 29
Eclipse download

Click on Download.

9 / 29
Eclipse download

Unzip the downloaded eclipse file.

Create a shortcut on your desktop to the eclipse.exe file in this


eclipse folder

Double-click the shortcut to Eclipse that you just created above.

10 / 29
Eclipse IDE

Introduction: This lab assignment is intended to familiarize you with


Eclipse IDE and the process of editing, compiling and executing a
simple Java Program. This lab has been designed with a specific set of
steps for you to follow. If you have any questions or run into any
trouble, please let your instructor know.
What is Eclipse? Eclipse is an integrated development environment
(IDE), which combines a text editor, a compiler, a virtual machine, and
a number of additional tools into one platform. In the context of
computing, Eclipse is used for developing applications using the Java
programming language and other programming languages such as
C/C++, Python, PERL, Ruby etc.
11 / 29
Eclipse IDE: Programming Environment Setup

Workspace selection
A workspace is the repository for all of the files that make up your
projects and all of your settings.
Step 1: Create your workspace folder under home directory of Ubuntu.
The folder name should be <Your Regd. No>
Example: (1641012001)
Step 2: Open Eclipse, go to File -> Switch Workspace -> Other
Enter (or Browse to) the workspace folder that you created)

12 / 29
Eclipse IDE: Programming Environment Setup

13 / 29
Eclipse IDE: Programming Environment Setup

Eclipse: A First Look: Find the Eclipse shortcut on the desktop and
double-click on it to start Eclipse.

14 / 29
Eclipse IDE: Programming Environment Setup

> This is an introductory screen that provides several links to more


information about Eclipse. Now, move the mouse to Workbench icon
(the rounded arrow on the right of the window) and click on it. This will
take you to the Java perspective shown below.
> The Eclipse window is always organized according to a perspective.
The current perspective determines the panels (views and editors) that
are displayed in the Eclipse window. The default perspective when
Eclipse is started for the first time is called the Java perspective which
is where you will do all of your programming work for this class. The
various panels in the Java perspective (Package Explorer/Hierarchy,
Outline, Problems/Javadoc/Declaration).
15 / 29
Eclipse IDE: Programming Environment Setup

16 / 29
Eclipse IDE: Creating a new java project

Select File->New->Java Project.

17 / 29
Eclipse IDE: Creating a new java project

Type Lab1 in the Project name box. Then click on the Finish
button at the bottom. This will create the new Lab1 project.

Now you can see a folder called Lab1 listed in the ”Package
Explorer.” This folder represents your new project. Now it is an
empty project.

The blank area in the center is meant for the editor which will
appear when we start editing our program. Note also that the
Lab1 project you just created is listed in the Package Explorer
panel on the left.

18 / 29
Eclipse IDE: Creating a new java project

19 / 29
Eclipse IDE: Create a new Java class

Go to File->New ->Class

20 / 29
Eclipse IDE: Creating a new java class

Type Welcome in the Name box. Select the checkbox next to


public static void main(String[] args) to make sure a main program
skeleton is created. Finally click on the Finish button. Here is what
the Eclipse window will look like, note that the editor panel now
displays the skeleton of our new java program.

21 / 29
Eclipse IDE: Create a new Java class

22 / 29
Eclipse IDE: Editing

Edit the program so that it looks exactly as shown below. Then click on
the Save button at the top left of the window to save your program.

23 / 29
Eclipse IDE: Compiling and Running a Program

Now it’s time to run your first program. Note that before running
the program it is necessary to compile it. However, by default,
Eclipse compiles your program after every save. So the program
is already compiled and you can execute it. If you made any Java
syntax mistakes in typing the program, Eclipse will list the errors in
the Problems tab under the editor window. Fix them and save the
program again.

To run the program, select Run->Run.

After a short time, the program will start and a new tab labeled
Console will appear in the bottom pane. This is the space where
you will be able to interact with your program.
24 / 29
Eclipse IDE: Compiling and Running a Program

25 / 29
Java Programming Style Guidelines

You must follow certain guidelines when writing Java code.


Each class must be in its own file.
The name of the file and the name of the class must coincide
exactly. For example the Queue class should be in a file named
Queue.java. Note that Java is case-sensitive (even though
Windows NT really isn’t).
Class names must start with an uppercase letter.
In addition, each ”word” within a class name should start with an
uppercase letter. For example, TextMessage and
SimpleTrafficMonitor are both appropriate class names.

The names of ”constants” (i.e., final variables) must be in all


uppercase.
26 / 29
Java Programming Style Guidelines

Other variable and method names that contain multiple characters


must not start with an uppercase letter.
Further, each ”word” within a variable name should start with an
uppercase letter. For example, importantMessage and
campusMonitor are both appropriate variable names.

Variable and method/function names must be descriptive. Index


variables and counters can, however, have names like i and j.
All variables must be declared at the top of the relevant class or
method (with two exceptions).
In the constructor of a derived class the call to the constructor of
the parent class must come first.
Index variables in loops may be declared locally.
27 / 29
Java Programming Style Guidelines

Variables (other than index variables in loops) must not be


declared and initialized in a single statement.
Each class and method must have a descriptive block comment.
The comment should describe the complete class and the
methods, its parameters, and its return value.

Comments in the body of a class should use // rather than /* ... */.
This isn’t a requirement but it will make your life easier.

Use indentation and use it consistently.


No particular indentation scheme is required but you must indent
your code in a meaningful and consistent way.

28 / 29
Documentation Style

29 / 29

You might also like