Panel | ||||||
---|---|---|---|---|---|---|
| ||||||
|
...
- Manually from Eclipse Downloads
- Via a package manager (snapcraft, pacman, etc.)
- The Eclipse Installer
Also see the official installation guide.
Recommended installation locations
...
/home/shadylady/tools/eclipse/eclipse-java
/opt/eclipse
(according to Linux#Manualsoftwareinstallation)/usr/lib/eclipse
(This is only if installed by an official system package manager)/snap/eclipse/current
(If installed viasnap
)
On Windows:
C:\ProgramData\eclipse\eclipse-java
The Eclipse INI Configuration File
Eclipse is launched with settings specified in an INI file in the installation directory called eclipse.ini. See the official eclipse.ini documentation. Changes to the INI file will take effect upon the next restart of Eclipse.
When Eclipse is installed via snap
There is no way to edit eclipse.ini directly when Eclipse is installed via snap. Workarounds include:
- Use the
--launcher.ini /path/to/eclipse.ini
option. - Pass individual settings e.g.
-vmargs -Xms1g -Xmx3g
to the launcher.
One alternative way to modify snap installs is through MenuLibre:
Follow these instructions to install MenuLibre:
sudo apt-get update
sudo add-apt-repository ppa:menulibre-dev/daily
sudo apt-get install menulibre
Now follow these instructions to modify eclipse.ini:
Copy
/snap/eclipse/current/eclipse.ini
to somewhere you can edit it. Let us say, copy it to/home/USERNAME/eclipse.ini
.Edit the arguments you want to update and save the file.
Open Menulibre
Search for "Eclipse."
Click in the Eclipse icon.
In the "Command" input, add the
--launcher.ini
option after the binary path. In our example, we would replace/snap/bin/eclipse %f
with
/snap/bin/eclipse %f --launcher.ini /home/USERNAME/eclipse.ini
Click in Menulibre's "Save" button.
Selecting a JVM
Eclipse 2020+ requires to run with a Java 11 VM or higher. If you need to set which JRE Eclipse runs with, add the following lines to the eclipse.ini.
Code Block |
---|
-vm
/path/to/jdk |
Workspaces
It is not recommended to put your code in a workspace directory. A "workspace" in Eclipse is more akin to isolated or "portable" application settings; not a place to store projects.
Warning |
---|
Is It is highly discouraged to put code in an Eclipse workspace folder. |
...
Configuration
Application memory
Eclipse will perform terribly unless you give it a few GB of memory (RAM).
In Ensure the installation folder, find eclipse.ini . Ensure is contains the following JVM options:
Code Block |
---|
-Xms512m -Xmx2g |
The values above are just an example. Scale them to fit your needs. See the official eclipse.ini documentation.The settings will take effect upon the next restart of Eclipse.
Create a desktop launcher
...
Code Block |
---|
[Desktop Entry] Name=Eclipse Comment=Java Development Environment Icon=/opt/eclipse/icon.xpm Exec=/opt/eclipse/eclipse Terminal=false Type=Application Categories=Development;IDE;Java; StartupNotify=true |
...
- Set "Refresh using native hooks or polling"
- Set "Show full workspace path"
- Set "Text file encoding" to "UTF-8"
- Set "New text file line delimiter" to "Unix"In "Build", set
Expand Workspace > Build. Set "Save automatically before build"
Gradle settings
Warning |
---|
Default Gradle settings in Eclipse are currently broken so you must "Override workspace settings" every time. See Github issue. |
In Window >Preferences > Gradle:
- Set "Gradle distribution" to "Local installation directory" and point to your local Gradle installationSee below: Importing Gradle Projects
Java settings
In Window > Preferences > Java:
Code Style > Formatter:
- Click "Import..." and import IHMC Open Robotics Software/ihmc-java-toolkit/CodeFormatTemplates/IHMCEclipseFormatter.xml
Compiler > Error/Warnings > Deprecated and restricted API:
...
- Click "New Type..." and add "
org.junit.jupiter.api.Assertions
"
Templates
In Editor > Templates:
Info | ||
---|---|---|
| ||
Create some updated templates for LogTools, JUnit 5, etc. |
Set up Installed JREs
See also the page on Java.
Code Style > Formatter:
- Click "Import..." and import IHMC Open Robotics Software/ihmc-java-toolkit/CodeFormatTemplates/IHMCEclipseFormatter.xml
Importing Gradle Projects
See also
Installing/Setting Up Eclipse
Importing Gradle projects into Eclipse
Importing Gradle projects into EclipseIn Java > Installed JREs, add any manually installed JREs. (i.e. Zulu in the /opt/zulu directory)
Check to make sure the jfxrt.jar
is present for JavaFX to work.
In the "Edit JRE" dialog, expand the *.jar entries and check if a Source attachement is detected. These should be detected automatically.
Plugins
JavaFX
To get JavaFX to work in Eclipse, a plugin is presently required. Follow the instructions to install e(fx)clipse:
- Go to Help > Eclipse Marketplace...
- Then search and install efxclipse
ANSI Color Console
This plugin provides nice log level coloring in the console as supported by IHMC's Log Tools library.
Search "ansi console" in the Marketplace and install ANSI Escape in Console by Mihai Nita.
C++ development
CMake editor: http://www.cthing.com/CMakeEd.asp
Eclipse file generator from CMake: https://gitlab.kitware.com/cmake/community/wikis/doc/editors/Eclipse-CDT4-Generator
EGit
Install Egit: http://www.eclipse.org/egit/download/
Set Git default Pull to 'rebase' as described in Git Tips And Tricks
In Window > Preferences > Team > Git > History:
- Set "Maximum characters to show for a tag" to 100
- Set "Maximum characters to show for a branch" to 100
Importing Gradle Projects
Warning |
---|
Default Gradle settings in Eclipse are currently broken so you must "Override workspace settings" every time. |
- Select File > Import...
- Select the "Gradle > Existing Gradle Project" import wizard
- Clear "Show the welcome page the next time the wizard appears"
- Set the "Project root directory"
- Select "Override workspace settings"
- Set "Gradle distribution" to "Local installation directory" and point to your local Gradle installation
(Common locations are/usr/share/java/gradle
,/opt/gradle
, andC:\gradle
) - Set "Show Console View"
- Set "Show Executions View"
- Set "Gradle distribution" to "Local installation directory" and point to your local Gradle installation
- (passive) Check that a tree populates on the "Import Preview" page
More info at https://github.com/eclipse/buildship/blob/master/docs/user/Overview.md#project-import
Troubleshooting
General troubleshooting steps for Eclipse are:
- Project > Rebuild
- Project > Clean...
- Gradle > Refresh Gradle Project
- File > Restart
- Create a new workspace
Adding and removing projects from workspace
It might be best to delete projects in Eclipse before deleting them on disk. Else your workspace might get corrupted if you try to delete from the File Explorer.
NoClassDefFoundError
Sometimes Eclipse will "forget" part of it's classpath. Recommended solution: Refresh Gradle Project
Code Block |
---|
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: com/martiansoftware/jsap/JSAPException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: com.martiansoftware.jsap.JSAPException
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more |
See also
TODO: How to run Gradle tasks with custom options
...