Getting started with eclipse

Download eclipse eBook

Remarks

This section provides an overview of what eclipse is, and why a developer might want to use it.

It should also mention any large subjects within eclipse, and link out to the related topics. Since the Documentation for eclipse is new, you may need to create initial versions of those related topics.

Versions

VersionNameRelease Date
3.02004-06-21
3.12005-06-28
3.2Callisto2006-06-30
3.3Europa2007-06-29
3.4Ganymede2008-06-25
3.5Galileo2009-06-24
3.6Helios2010-06-23
3.7Indigo2011-06-22
3.8 and 4.2Juno2012-06-27
4.3Kepler2013-06-26
4.4Luna2014-06-25
4.5Mars2015-06-24
4.6Neon2016-06-22
4.7Oxygen2017-06-28
4.8Photon (Planned)2018-06-01

Creating and Running a Java HelloWorld Program

From the tool-bar open the Java Perspective.

0

Create a new Java project

Right-click into the Package Explorer, and from the menu select New -> Java Project

In the upcoming dialog enter a project name, then click Finish .

2

Now you have the new project in your workspace.

3

Create a new Java class

Right-click on your project, and from the menu select New -> Class .

In the dialog type in the class' name (it should begin with a capital letter), also select the check-box public static void main(String[] args) , then click Finish .

5

Now you have the first Java file in your project. The editor will automatically open this new file.

6

Within the main method type in some code to print Hello world! .

7

Run your Java class

Right-click on your Java class, and from the menu select Run as -> Java application .

Voila, you see the output of your Java program in the Console.

9

Importing Existing Projects

In the File menu, choose the 'Import...' option.

enter image description here

This opens up the Import dialog box, which asks for the type of project/file you want to import. For a basic Java project, choose 'Existing Projects into Workspace' from the 'General' folder.

enter image description here

Next, select the directory where the project(s) is located using the 'Browse' button. All projects that can be imported into Eclipse will show up in the 'Projects:' section. If the project has already been imported, it will still be displayed but the checkbox will be disabled.

enter image description here

You can also import projects directly from a compressed file by choosing 'Select archive file' and then clicking the 'Browse' button.

Once you click 'Finish' the project is now visible in your Project Explorer and ready to use.

enter image description here

Install Marketplace in Eclipse

Few of the eclipse classic versions don't come pre-installed with marketplace, this maybe installed using the following steps:

  1. Goto Help → Install new Software
  2. Add new Repository(site specified below)
  3. General Purpose Tools → Marketplace Client
  4. Click Finish and you are done.

Marketplace update sites:

Oxygen - http://download.eclipse.org/releases/oxygen/
Neon - http://download.eclipse.org/releases/neon/
Mars - http://download.eclipse.org/releases/mars/
Luna - http://download.eclipse.org/mpc/luna
Helios - http://download.eclipse.org/releases/helios
Juno - http://download.eclipse.org/releases/juno/
 

Installation and Setup

To install Eclipse, go to the Eclipse Downloads Web page where there is usually a direct link to download the latest version of Eclipse. Starting Eclipse Mars (version 4.5), an installer can be downloaded which guides you through the installation procedure, as opposed to downloading the whole installation as a compressed file (this option is still available, however). There are also links to download old Eclipse packages.

Eclipse comes in several different packages that target different users as shown in the below screenshot from the installer. For instance, the Eclipse IDE for Java Developers contains basic tools that support developing, debugging and building Java applications, as well as basic support for version control such as a plugin that allows versioning projects using Git, while the Eclipse for Android Developers provides an environment for creating Android applications.

enter image description here

Once a package is selected, the next page allows the user to select the installation directory, along with other options. The following screenshot illustrates the procedure on a Windows machine.

enter image description here

Clicking the Install button will start the installation of the Eclipse package into that directory.

If the machine already has Java properly installed, Eclipse should launch fine and no configuration or setup is usually required. However, it is a good practice to change some configuration options for Eclipse, for example to specify in which JVM Eclipse should run, and to configure minimum and maximum memory for that JVM. To do so, a file called eclipse.ini exists in the installation directory, where this startup configuration is located. This page contains details about how to configure Eclipse using that file.

Useful Keyboard Shortcuts

Manage Files and Projects

  • Ctrl+Shift+R : Open Resource (file, folder or project)
  • Ctrl+Shift+S : Save all files
  • Ctrl+W : Close current file
  • Ctrl+Shift+W : Close all files

Editor Window

  • F12 : Jump to Editor Window
  • Ctrl+E : Show list of open Editors. Use arrow keys and enter to switch
  • Ctrl+Page Down/Up : Switch to next editor / switch to previous editor
  • Ctrl+M : Maximize or minimize current Editor Window

Navigate in Editor

  • Ctrl+L : Go to line
  • Ctrl+Q : Jump to last location edited
  • Ctrl+Shift+P : With a bracket selected: jump to the matching closing or opening bracket
  • Ctrl+Arrow Down/Up : Scroll Editor without changing cursor position

Edit Text

  • Ctrl+D : Delete Line
  • Alt+Shift+Y : Wrap selected text (fit text width to screen)
  • Alt+Shift+S : Open Source menu options
  • Alt+Shift+R : Refactor highlighted word across all files
  • Ctrl+Alt+Up/Ctrl+Alt+Down : Copy the selected lines to top/down.

Search and Replace

  • Ctrl+J : Type a term to search then use Ctrl+J / Ctrl+shift+J to go up/back
  • Ctrl+K/Ctrl+Shift+K : Ctrl+H then close find window. Then Find previous / next occurrence of search term.

Move a block of code

  • Shift+tab : Move to the left
  • Alt+Up/Alt+Down : Move to top/down.

Stats

125 Contributors: 9
Friday, August 4, 2017
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook