Configuring Eclipse For Java

Home > Articles > Programming > Java

  1. Create Shared User Libraries
< BackPage 2 of 6Next >

On a Mac: In Eclipse’s main menu, select Eclipse→Preferences. As a result, Eclipse’s Preferences dialog appears. In the tree on the left side of the Preferences dialog, expand the Java branch. Within the Java branch, select the Installed JREs sub-branch.

This chapter is from the book
  • Run the Eclipse installer. You should see a window like the one below; Select the first 'Eclipse IDE for Java Developers' option. After that point, you can keep hitting 'yes' and select all the default options (unless you want to change something). You should eventually see a screen like this.
  • Configure Eclipse with Selenium Webdriver in Java. Download Install for Eclipse Setup. Download Selenium Webdriver 3. Add Selenium Jar Files into Eclipse 4. Download Third Party Browser Driver e.g(Gecko, Chrome etc) 1. Download Install and Setup Eclipse. Step 1: Go to google then search eclipse download. Click on Eclipse Downloads.
  • Configure Eclipse with Selenium Webdriver in Java. Download Install for Eclipse Setup. Download Selenium Webdriver 3. Add Selenium Jar Files into Eclipse 4. Download Third Party Browser Driver e.g(Gecko, Chrome etc) 1. Download Install and Setup Eclipse. Step 1: Go to google then search eclipse download. Click on Eclipse Downloads.
  • You can download the latest version of Eclipse for Java for Windows. The installer is small utility that will configure, download, and install the particular Eclipse variant you’re looking for. For brevity’s sake, and due to platform differences, we’ll skip the actual install steps in this guide.
Eclipse Distilled

This chapter is from the book

This chapter is from the book

6.2 Create Shared User Libraries

Configure Eclipse For Javascript

When working with third-party commercial or open source libraries, or with standard APIs such as J2EE, it's common to require several JAR archives in combination. If these are used in only one project, then you can configure the build path as described in the previous section. However, you may need to include the libraries several times in a modular multi-project structure. It would be easier to define the combined library as a single entry.

This kind of configuration is called a user library in Eclipse. The JAR files contained within a user library are identified by an absolute file path external to the Eclipse workspace. It's helpful to have a consistent location for these libraries on your local or network file system. A library's files also might be located within a vendor product installation directory. We'll use the following file structure:

Download the Apache Axis distribution (see References) and unzip its JAR files into the axis-1.2beta folder (or a similar folder name based on a newer version). Standard vendor-independent interface libraries are available for J2EE specifications such as Servlets, EJB, JNDI, JavaMail, and others; place these JARs into the j2ee folder. Many other useful utilities are available from the Apache Jakarta project, including the log4j library. Place these JAR files in the jakarta-basic and jakarta-j2ee folders.

We could use a classpath variable to include J2EE library files from Tomcat or JBoss installations, just as we did with the Servlet library earlier in this chapter. However, because we may deploy to several different application servers, and because our project code is written to the standard J2EE APIs, we gain more flexibility by creating a vendor-independent J2EE user library. A user library allows us to add a single Java Build Path entry that includes all JAR files required for our J2EE development.

Open the Eclipse preferences page for user library configuration located in the category Java > Build Path > User Libraries. The configuration for the Apache Axis library is shown in Figure 6-7. Press the Add JARs.. button, browse to the Axis library folder, and select the archive files.

Figure 6-7 Create a new user library for the Apache Axis Web Services toolkit.

Download source and Javadoc ZIP files for each user library, if they are available. Doing so enables maximum benefit from Content Assist and Javadoc display when using these libraries in Eclipse. For convenience, place these files in the same directory as the binary JAR files. While adding each JAR file to the user library, also edit the associated Javadoc location and source attachment parameters. These values are shown for the axis.jar file in Figure 6-7.

The user library preferences page includes buttons for importing and exporting library definitions to a separate file that can be shared with your team members—note that this import/export is separate from the more general import/export of all workbench preferences. Export your new libraries to a file named EclipseDistilled.userlibraries and then notify other team members that they should import this file into their user library settings. This file does not contain the library's files—it only contains the file path locations to JARs, source attachments, and Javadoc HTML.

If others who import this file use a different file structure for organizing their external library files, they must edit the library definitions to remove and add the JAR files with correct path locations. Unfortunately class path variables are not available to parameterize the library file locations.

6.2.1 Linked Library Project

A useful hybrid strategy is to configure a user library that is also available as a linked folder in your Eclipse workspace. Follow these steps:

  1. Create a simple project in your workspace. Unlike Java projects, a simple project has no Java build path configuration in its properties. Use the command File > New > Project > Simple Project.

  2. Uncheck the option to use a default project location within the workspace folder and enter the path for your eclipse-contriblibraries folder (see Figure 6-8).

  3. Figure 6-8 Create a new simple project with linked folder location.

  4. Your new libraries project should look similar to the one in Figure 6-9.

Figure 6-9 Java projects with sharing common libraries.

The Apache Axis distribution includes both the source code and Javadoc HTML files in one ZIP file, which is named axis-src-1_2beta.zip in this illustration. This file is used within the user library configuration to add source attachment and Javadoc to classes in this JAR file. Also notice the inclusion of a PDF specification file related to the JAX RPC library. You can double-click this file from within Eclipse to launch an external PDF reader.

In previous configuration of the orders project, we created a lib subfolder, copied the log4j JAR file into it, and then added this archive to the project build path. However, this approach can lead to a lot of duplication when we need the same JAR in several projects. Now we can use the shared libraries project to add log4j, or other jakarta-basic archives, into any of our projects.

In Figure 6-9, the shared log4j JAR has been added to both the orders and ubl projects. In addition, the Apache Axis Library is also included in the ubl project configuration as a user library; it includes a combination of six interdependent JAR files.

Eclipse has very flexible capabilities for configuring user libraries and leaves opportunity for creative arrangements. The hybrid approach described here has several benefits:

  • Gather all of your open source libraries in a common folder named /eclipse-contrib/libraries.

  • Download binary, source, Javadoc, and other related specifications into the same folder. Leave source and Javadoc files compressed in ZIP files.

  • Create a simple project in each Eclipse workspace using a linked folder location for the project's contents. If you use multiple workspaces to separate your work as described in Chapter 3, then they can share the same reference libraries.

  • Create user libraries when you often use several JAR files in combination. Export the user library definitions to share them between workspaces.

  • Use the libraries project to add other individual JAR files to the build path of Java projects; use the Add JARs.. button for portable location references.

  • Navigation
  • Main Page
  • Community portal
  • Current events
  • Recent changes
  • Random page
  • Help
  • Toolbox
  • Page information
  • Permanent link
  • Printable version
  • Special pages
  • Related changes
  • What links here

Installing Eclipse is relatively easy, but does involve a few steps and software from at least two different sources. Eclipse is a Java-based application and, as such, requires a Java Runtime Environment or Java Development Kit (JRE or JDK) in order to run.

Note that on recent versions of Mac, a full JDK needs to be installed, not just a JRE; see instructions below.

Install a JVM

The latest release of Eclipse requires a 64-bit JVM, and does not support a 32-bit JVM.


Current releases of Eclipse require Java 11 JRE/JDK or newer.


If you are using Eclipse to do Java development, or are on macOS, install a JDK.In all cases, Eclipse requires a 64-bit JVM

A Java Development Kit (JDK) includes many useful extras for Java developers including the source code for the standard Java libraries.


Regardless of your operating system, you will need to install some Java virtual machine (JVM). You may either install a Java Runtime Environment (JRE), or a Java Development Kit (JDK), depending on what you want to do with Eclipse. If you intend to use Eclipse for Java development, then you should install a JDK. If you aren't planning to use Eclipse for Java development and want to save some disk space, install a JRE.

  • If you're using Windows, you may already have a JRE installed, but upgrading usually won't hurt.
  • If you're using Mac, and you don't have a JDK installed, you may get a bogus message from the OS stating that you should 'install the legacy Java SE 6 runtime'. Installing that will not solve the problem, because recent versions of Eclipse require a higher version. If you install just a JRE, and not a full JDK, that error message will persist. You must install a full JDK.
  • If using Linux, read this
    • GCJ will NOT work.

Eclipse 4.19 (2021-03)

Eclipse 4.19 (2021-03) was released on March 17, 2021. It is the supported release.

A Java 11 or newer JRE/JDK is required, LTS release are preferred to run all Eclipse 2021-03 packages based on Eclipse 4.19, with certain packages choosing to provide one by default. The Installer now includes a JRE. Consider using the Installer. Please see 5 Steps to Install Eclipse.

Eclipse 4.18 (2020-12)

Eclipse 4.18 (2020-12) was released on December 16, 2020.

A Java 11 or newer JRE/JDK is required, LTS release are preferred to run all Eclipse 2020-12 packages based on Eclipse 4.18, with certain packages choosing to provide one by default. The Installer now includes a JRE. Consider using the Installer. Please see 5 Steps to Install Eclipse.

Eclipse 4.17 (2020-09)

Eclipse 4.17 (2020-09) was released on September 16, 2020.

Consider using the Installer. Please see 5 Steps to Install Eclipse.

A Java 11 or newer JRE/JDK is required, LTS release are preferred to run all Eclipse 2020-09 packages based on Eclipse 4.17, as well as the Installer.

Eclipse 4.16 (2020-06)

Eclipse 4.16 (2020-06) was released on June 17, 2020.

Consider using the Installer. Please see 5 Steps to Install Eclipse.

A Java 8 or newer JRE/JDK is required, LTS release are preferred to run all Eclipse 2020-06 packages based on Eclipse 4.16, as well as the Installer.

Eclipse 4.15 (2020-03)

Eclipse 4.15 (2020-03) was released on March 18, 2020.

A Java 8 or newer JRE/JDK is required, LTS release are preferred to run all Eclipse 2020-03 packages based on Eclipse 4.15, as well as the Installer.

Eclipse 4.14 (2019-12)

Eclipse 4.14 (2019-12) was released on December 18, 2019. See Eclipse 2019-12 schedule.

Consider using the Installer. Please see 5 Steps to Install Eclipse.

A Java 8 or newer JRE/JDK is required to run all Eclipse 2019-09 packages based on Eclipse 4.14, as well as the Installer.

Eclipse 4.13 (2019-09)

Eclipse 4.13 (2019-09) was released on September 18, 2019. See Eclipse 2019-09 schedule.

Consider using the Installer. Please see 5 Steps to Install Eclipse.

A Java 8 or newer JRE/JDK is required to run all Eclipse 2019-09 packages based on Eclipse 4.13, as well as the Installer.

Eclipse 4.12 (2019-06)

Eclipse 4.12 (2019-06) was released on June 19, 2019. See Eclipse 2019-06 schedule.

Consider using the Installer. Please see 5 Steps to Install Eclipse.

A Java 8 or newer JRE/JDK is required to run all Eclipse 2019-03 packages based on Eclipse 4.12, as well as the Installer.

Eclipse 4.11 (2019-03)

Eclipse 4.11 (2019-03) was released on March 20, 2019. See Eclipse 2019-03 schedule.

Consider using the Installer. Please see 5 Steps to Install Eclipse.

A Java 8 or newer JRE/JDK is required to run all Eclipse 2019-03 packages based on Eclipse 4.11, as well as the Installer.

Eclipse 4.10 (2018-12)

Eclipse 4.10 (2018-12) was released on December 20, 2018. It is the supported release. See Eclipse 2018-12 schedule.

Consider using the Installer. Please see 5 Steps to Install Eclipse.

A Java 8 or newer JRE/JDK is required to run all Eclipse 2018-12 packages based on Eclipse 4.10, including running the Installer. The reasoning behind requiring Java 8 are discussed here.

Eclipse 4.9 (2018-09)

Eclipse 4.9 (2018-09) was released on September 19, 2018. See Eclipse 2018-09 schedule.

A Java 8 or newer JRE/JDK is required to run all Eclipse 2018-09 packages based on Eclipse 4.9, including running the Installer. The reasoning behind requiring Java 8 are discussed here.

Eclipse 4.8 (Photon)

Eclipse 4.8 (Photon) was released on June 27, 2018. See Photon schedule.

A Java 8 or newer JRE/JDK is required to run all Oxygen packages based on Eclipse 4.7, including running the Installer. The reasoning behind requiring Java 8 are discussed here.

Eclipse 4.7 (Oxygen)

Eclipse 4.7 (Oxygen) was released on June 28, 2017. Dhital task chair. See Oxygen schedule.

A Java 8 or newer JRE/JDK is required to run all Oxygen packages based on Eclipse 4.7, including running the Installer. The reasoning behind requiring Java 8 are discussed here.

Eclipse 4.6 (Neon)

Configure Eclipse For Java Tutorial

Eclipse 4.6 (Neon) was released on June 22, 2016. See Neon schedule.

A Java 8 JRE/JDK is required to run all Neon packages based on Eclipse 4.6, including the Installer. The reasoning behind requiring Java 8 are discussed here.

Eclipse 4.5 (Mars)

Eclipse 4.5 (Mars) was released on June 24, 2015.

A Java 7 JRE/JDK is required for all Mars package downloads based on Eclipse 4.5, including the Installer. Information concerning tested configurations for Eclipse 4.5 is provided here.

Eclipse 4.4 (Luna)

Eclipse 4.4 (Luna) was released on June 25, 2014.

Eclipse

A Java 7 JRE/JDK is required for most of the Luna package downloads based on Eclipse 4.4. Information concerning tested configurations for Eclipse 4.4 is provided here.

Eclipse 4.3 (Kepler)

Eclipse 4.3 (Kepler) was released in June 2013.

A Java 6 JRE/JDK is recommended for Eclipse 4.3. More information concerning tested configurations for Eclipse 4.3 is provided here.


JRE/JDK Sources

Be sure to install a JVM with the same bit level as Eclipse
i.e. install a 32-bit JRE to run 32-bit Eclipse; install a 64-bit JRE to run 64-bit Eclipse

There are several sources for a JRE/JDK. Here are some of the more common/popular ones (listed alphabetically):

Download Eclipse

Download Eclipse from the Eclipse Downloads Page.

There are several package choices. Note that you can install the features from any package into any other package. If you are, for example, planning to do mostly Java development and some C/C++ development, you should download the Eclipse IDE for Java Developers and then add the C/C++ development tools via the 'Help > Install New Software..' menu option.

The download will be delivered as a compressed (i.e. a '.zip', or '.tar.gz') file. Decompress this file into the directory of your choice (e.g. 'c:eclipse' on Windows) and ensure you have full Read and Execute permissions. You can optionally create a shortcut of the executable file ('eclipse.exe' on Windows, or 'eclipse' on Linux).

Note that there is a known problem with the built-in decompression utility on all current versions of Windows. We recommend that you use a more robust decompression utility such as the open source 7zip when decompressing an Eclipse download. Some people report success when initially decompressing Eclipse into a root directory (e.g. c:) and then moving it to a more appropriate home (e.g. c:Program FilesEclipse)

Configure Eclipse to use the JVM

Configure Eclipse For Javafx

It is strongly recommended to configure Eclipse with the specific JVM that you want. See the instructions at Eclipse.iniThis is a very important step to be sure that Eclipse is using the JVM you intend and can't be influenced by any other software that might alter your system.The JVM used to launch Eclipse has no affect on whether it can compile Java sources for other Java language versions.

Extending Eclipse

Use the Help > Install new software.. menu option to add Kepler features to your Eclipse installation (you can, for example, use this option to add C/C++ development support). Additionally, you can tap into a vast collection of extensions provided by the Eclipse community and ecosystem via the Eclipse Marketplace Client (Help > Eclipse Marketplace). Note that not all Eclipse packages contain the Eclipse Marketplace Client.

Troubleshooting

Java was started but returned exit code = 13

If you've 'installed' Eclipse but are having trouble getting it to run, the most likely cause is that you have not correctly specified the JVM for it to run under. You may need to edit the eclipse.ini file.

Configure Eclipse For Java 15

Another common mistake on Microsoft Windows is a mismatch between the 'bittedness' of Eclipse and the JVM/JDK. This is the most frequent cause of an Error 13. 64-bit Eclipse requires a 64-bit JVM, and 32-bit Eclipse requires 32-bit JVM--you can not mix-and-match between 32-bit and 64-bit, so make sure the version of Eclipse you installed matches the JVM/JDK that you're using to run it (and make sure you're using eclipse.ini to specify the exact JVM used to run Eclipse, described above).

As a simple test, open a Command Prompt window, move to the directory that is pointed to by the -vm argument in your eclipse.ini, and run the intended java.exe with the -d32 switch to test if it supports 32-bit, or -d64 to test for 64-bit support. It's often simplest to download a version of Eclipse that will work with whatever Java you already have installed.

Configuring Eclipse For Java 11

To open 'Eclipse' you need to install the legacy Java SE 6 runtime

On more recent versions of the Mac, if you don't have a full JDK of an appropriately high version installed, the OS produces this bogus message. Installing any JRE will not eliminate this problem. A full JDK needs to be installed on the Mac.

Extraction requires a password or otherwise fails on Windows.

Configure Eclipse For Java 14

Eclipse downloads are not password protected. This is a known problem with the built-in decompression utility on all current versions of Windows. We recommend that you either download the installer or use a more robust decompression utility such as the open source 7zip when decompressing an Eclipse download. Some people report success when initially decompressing Eclipse into a root directory (e.g. c:) and then moving it to a more appropriate home (e.g. c:Program FilesEclipse)

More information

Retrieved from 'https://wiki.eclipse.org/index.php?title=Eclipse/Installation&oldid=442664'