Eclipse - yenbohuang/techNotes GitHub Wiki

Plugins

Useful plugins

CI

Editors

Version controls

  • EGit
    • Pre-installed in latest Eclipse versions.

Decompiler

Database

Theme

Optional plugins

Editors

Version controls

Testing

Others

Short-Cuts

Preferences -> General -> Keys:

Description Short Cut
Finding Java classes Ctrl + Shift + T
Find implementation Click at method or Class, then Ctrl + T
Find files Ctrl + Shift + R
Search Ctrl + H
Go to line number Ctrl + L
Word wrap in editor Ctrl + Alt + Y
Comment/uncomment Ctrl + /

See details on:

Maven

User settings

Maven plugin uses a settings file where the configuration can be set. Its path is available in Window|Preferences|Maven|User Settings. If the file doesn't exist, create it and put on something like this:

See "user settings" in https://github.com/yenbohuang/techNotes/blob/master/Programming/Maven.md.

After editing the file, it's just a matter of clicking on update settings button and it's done. I've just done it and it worked :)

See details on http://stackoverflow.com/questions/7737710/maven-plugin-not-using-eclipses-proxy-settings

Hudson/Jenkins Mylyn Builds Connector

Use this plug for submit/monitor Hudson/Jenkins builds.

http://marketplace.eclipse.org/content/hudsonjenkins-mylyn-builds-connector

Installing m2e plugins

Install m2e plugins by "Preferences -> Maven -> Discovery -> Open Catalog".

See details on http://stackoverflow.com/questions/8360131/how-to-configure-checkstyle-in-eclipse-for-an-maven-project-automaticaly

Setting

Intelli-sense

  • Windows -> Preferences -> Java -> Editor -> Content Assist
  • Auto Activation -> Auto Activation Trigger for Java
  • Change "." to ".(abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"

See details on http://stackoverflow.com/questions/2943131/eclipse-intellisense

Export Preferences

File -> Export -> General -> Preferences

Enable debug view

Debug View

See details on https://github.com/yenbohuang/techNotes/tree/master/IDE

Using UTF-8

  • Windows > Preferences > General > Content Types, set UTF-8 as the default encoding for all content types.
  • Windows > Preferences > General > Workspace, set "Text file encoding" to "Other : UTF-8".

See details on http://stackoverflow.com/questions/9180981/how-to-support-utf-8-in-eclipse

Display Memory Usage in Task Bar

  • Windows > Preferences > General > Show Heap Status checkbox

eclipse.ini

Change UI language

-Duser.language=en

-vm

OpenJDK is usually pre-installed in Linux distributions (e.g. Ubuntu, CentOS.) If we'd like to use Oracle JDK for running Eclipse, we have to provide the JDK path in eclipse.ini:

-vm
/opt/sun-jdk-1.6.0.02/bin/java

See details on https://wiki.eclipse.org/Eclipse.ini#-vm_value:_Linux_Example

You should use "javaw.exe" on windows, or the cmd console will show up:

-vm
C:/Program Files/Java/jdk1.8.0_192/bin/javaw.exe

See details on https://stackoverflow.com/questions/2908188/how-to-turn-off-eclipse-console-on-windows/2908462#2908462

Workaround KDE GTK3 incompatible issues

Add these 2 lines before the line "--launcher.appendVmargs":

--launcher.GTK_version
2

See details on https://bbs.archlinux.org/viewtopic.php?id=200053

Subversion

Using local SVN repo

  • Install SVN command-line tool
  • Create folder 'd:\svn-repo'
  • Create SVN repo by 'svnadmin create myproject' under 'svn-repo' folder.
  • Use URL 'file:///d:/svn-repo/myproject'

See details on http://www.jayway.com/2009/04/03/setting-up-a-local-subversion-repository-to-use-with-your-eclipse/

Java HL on Ubuntu

The followings are the extra steps except install Java HL by Eclipse:

  • Run sudo apt-get install libsvn-java
  • Run locate libsvnjava and find the path.
  • Add the following line into eclipse.ini
    -Djava.library.path=/usr/lib/x86_64-linux-gnu/jni

See details on http://stackoverflow.com/questions/3274890/javahl-not-loading-noclassdeferror

Subclipse

Enter username/password and frozen when "save password" is checked.

Find org.eclipse.core.runtime.compatibility.auth_3.2.300.v20120523-2004.jar and put it in Eclipse/plugins.

See details on http://stackoverflow.com/questions/35744794/eclipse-mars-freezes-on-subclipse-password-store

JAR file can be download from here (or somewhere else): http://ftp.gnome.org/mirror/eclipse.org/eclipse/updates/3.8/R-3.8.2-201301310800/plugins/

Subversive

Comparing files from the commit dialog always yields a "no differences" result

This is a bug and still waiting for the fix after Neon.2 (4.6.2). See details on https://bugs.eclipse.org/bugs/show_bug.cgi?id=497160

Git

Add toolbar

  • Click at "Menu Bar -> Window -> Perspective -> Customize Perstive"
  • Check "Git" under "Action Set Availability"

See details on http://www.vogella.com/tutorials/EclipseGit/article.html#egitconfiguration_toolbar

Using Tomcat in Eclipse

Eclipse use the following in launch configuration:

-Dcatalina.base="D:\ws-git\.metadata\.plugins\org.eclipse.wst.server.core\tmp0" 
-Dcatalina.home="D:\PortablePrograms\apache-tomcat-8.0.28" 
-Dwtp.deploy="D:\ws-git\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps" 
-Djava.endorsed.dirs="D:\PortablePrograms\apache-tomcat-8.0.28\endorsed"

Cygwin for CDT

  • Install Cygwin dependencies properly. I am too lazy to check them, so, I installed everything.
  • Add "%cygwin%\bin" to "PATH" environment variable.
  • Go to "Windows -> Preference -> C/C++ -> Debug -> Source Lookup Path"
    • Add "Path Mapping"
    • "\cygdrive\c" -> "c:"
    • "\cygdrive\d" -> "d:"

See details on http://wyding.blogspot.tw/2009/04/setup-cygwin-toolchain-in-eclipse-cdt.html

Creating linked resources

Create folder shortcut without creating projects:

  • Create a non-Java project.
  • Right click and choose "New -> Folder".
  • Enter folder name and expend "Advanced" button.
  • Choose "Link to alternate location (Linked Folder)" and click "Browse" button.

Version control function cannot be done on linked resources; do it by command-line utilities instead.

See details on http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Ftasks%2Ftasks-45.htm

Scala

Compile Error for Scala + Java Projects

Some projects contains both Scala and Java source codes. You will see this error if you didn't install m2e-scala and Scala IDE.

Plugin execution not covered by lifecycle configuration: net.alchim31.maven:scala-maven-plugin:3.2.1:add-source 
(execution: scala-compile-first, phase: process-resources)
Plugin execution not covered by lifecycle configuration: net.alchim31.maven:scala-maven-plugin:3.2.1:compile 
(execution: scala-compile-first, phase: process-resources)
Plugin execution not covered by lifecycle configuration: net.alchim31.maven:scala-maven-plugin:3.2.1:testCompile 
(execution: scala-test-compile, phase: process-test-resources)

Remember changing compiler target to "jvm-1.8": Window -> Preferences -> Scala -> Compiler -> Standard -> target drop down list.

See details on:

Install sbteclipse

Add self-signed Bugzilla host to Mylyn

If your sever uses a certificate and fails to connect, e.g. you see exceptions sun.security.validator.ValidatorException: PKIX path building failed then you need to point Eclipse at your certificate

Follow the steps:

  • Download Portecle and run it
    • java -jar portecle.jar
    • Click at "Exam -> Exam SSL/TLS Connection" menu item
      • Enter hostname without http::// or https://
      • Export certificate by "PEM Encoding" button
    • Click at "File -> Open Keystore File" menu iitem.
      • Open %JAVA_HOME%\lib\security\cacerts
        • C:\Program Files\Java\jre1.8.0_65\lib\security\cacerts
        • The default password is changeit
      • Click "Import Trusted Certificate" button and trust this certificate.
      • Save the change.
  • Restart Eclipse
    • Open "Task Repositories" view
      • "Add Task Repository"

See details on: