Skip to content

Instantly share code, notes, and snippets.

@brijesh-deb
Last active July 16, 2019 06:58
Show Gist options
  • Save brijesh-deb/4f04e7bf9b404550af0312a3c3523e3b to your computer and use it in GitHub Desktop.
Save brijesh-deb/4f04e7bf9b404550af0312a3c3523e3b to your computer and use it in GitHub Desktop.
#CheatSheet #Eclipse

Eclipse CheatSheet

Shortcuts

  • Ctrl + Shift + R : find resource
  • Ctrl + Shift + T : find type
  • Ctrl + O : find method, variable in a class file
  • Ctrl + L : go to a specific line number
  • Ctrl + H: text search
  • F5 : step into
  • F6 : step over
  • F8: resume
  • Ctrl + Alt + H : to find where all a method is called
  • Ctrl + Shift + G : find where a method is used
  • right-click on a class, select references/Project: to find where all a class is used

Convert a project to Java project

  • Right click on the project
  • Go to Properties > Project Facets
  • Select Java and apply

Check where all a class method is used

  • Select the class/method
  • Right click references/project

Change/Set JDK path to be used

  • Open eclipse.ini file in eclipse home folder
  • Change value for -vm setting
-vm
C:\Program Files\Java\jdk1.8.0_191\bin\javaw.exe

Trouble Shooting

1) This compilation unit is not on the build path of a Java project.

  • Add the following in .project file
<natures>
      <nature>org.eclipse.jdt.core.javanature</nature>
</natures>
  • Clean the project and build again.

2) Missing Maven dependencies in Eclipse project

  • Open .classpath file at the root of the project
  • Add following
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
            <attribute name="org.eclipse.jst.component.nondependency" value=""/>
        </attributes>
</classpathentry> 
  • Rebuild project (Project> Clean and Build)
  • Right Click on project > Properties> Java Build Path > Libraries
  • Maven Dependencies will be listed now

3) .class file opens instead of .java while debugging

  • Select project
  • Run > Debug Configuration > Source
  • Remove Default and select your project
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment