Eclipse Settings

Posted by

The below settings I use day to day in my development life cycle at work which are pretty useful when I need to be more productive

1. Leaving searched files open after clicking to open

This is a very annoying situation where I search files and end up with multiple outcomes, when I click on different files then Eclipse closes the other file where it is supposed to remain in my preference. So this setting will help you out the most

Go to Window –> Preferences –> General –> Search

Remove the check on “Reuse editors to show matches” option and save

searcheclipseappend

2. Showing heap status

Eclipse has this nice feature showing current heap status with a progress bar as well as allocated and available heap spaces

Go to Window –> Preferences –> General

Check the “Show heap status” option

3. Showing line numbers

Go to Window –> Preferences –>General –> Editors –> Text Editors

eclipseshowlinenumbers

4.Increasing Heap size and Setting out JDK Path

Higher number of Heap size allows you to allocate bigger spot in JVM when fired up through Eclipse as well as the full path of JDK on the other hand enables you to use a specific version of a JDK. Open your eclipse ini and add the following lines

behind plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.300.v20150602-1417

add the following line and replace your jdk path with the below one. P.S. your advised to install JDK on your root C drive to defer long path issues!
-vm
C:/jdk1.8.0_66/bin/javaw.exe

-Xms1G
-Xmx4G

here Xms corresponds to the smallest and Xmx corresponds to the maximum value. You can use G or M to define it upon your wish. if you want to to define the value in Megabyte type then you’ll identify the full body for example 1G –> 1024M

 5. Remote debugging

Remote debugging is a great feature when you are intended to debug an application runs on a remote server. It’s assumed that the remote server is accepting the connection at port 8000 (This may vary your application server please consult your administrator screen or the config file for the port)

remotedebug0

Right click the file you are willing to debug Debug as –>  Debug Configurations

remotedebug1

Then after this point the configuration screen will appear here enter the server details ip address/hostname of the server ,in my case I’ll test it out on my localserver, and enter the port information later proceed to debug.

remotedebug2

 

After these steps Eclipse will be connecting to the debug server and catch any of your pointers at the execution time.

P.S. If it fails to connect to troubleshoot the issue, telnet to the server to see there is no firewall or the server up and running as well as accepting connections at the given port. (Connection string: telnet SERVERIP/SERVERHOSTNAME CONNECTIONPORT)

remotedebug3

6. Open Resource

This feature will allow you to open any file in a massive project. You’ll not have to bother yourself to go through project folder structure to open up the desired file. The shortcut is : Ctrl+Shift+R

You can also use wildcard characters like asteriks (*) to search all corresponding file names

openresource

7. Working set

Working set is a fabulous option when you search a specific file in a specific project whereas in the eclipse workspace there are many of projects reside. Open up search (Ctrl+H)

Then type in the file name you want to be searched,click on Working set and press on Choose

workingset1

in this screen proceed to click on the new button

workingset2

Select the file types in which your entered file name to be searched through out given project set that you’ll set out in the upcoming screen

workingset3

Assign a name to be set as your working set which will later appear in the working set list, and select the project(s) in which given file name to be search for

workingset4

Then choose your working set name and click on ok

workingset5

Click on on to begin the search process

workingset6

Then your search result list will appear on the Search tab

workingset7

 

8.JD plugin

JD Decompiler is a very useful and splendid eclipse plugin ever. You can decompile any of compiled Java class files. The instructions are given at the plugin website in the regarding eclipse tab. Please visit Plugin’s website

 

9. Lombok Plugin

Lombok plugin allows you to reduce boilerplate code of  setters, getters toString and other methods provided by Java. You can simply call annotations to produce the method you wish to. The Project Website the installation is very simple. Just download the jar, as soon as you fire up the jar file, installed Eclipse versions and supported variants (STS and JBoss studio) will be listed

lombok1

you’ll simply click on “Install/Update” as you go, then it will copy its jar file into the root of the selected IDE and add an entry into the eclipse.ini file

lombok2

 

and configure the plugin on your dependency manager like maven

<dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.14.4</version>
</dependency>

Troubleshoot: if you encounter issues as I did while attempting to use lombok, the checklist is;

1.Check the About installed plugin windows to see whether the plugin is listed

lombok3

2.start eclipse.exe

eclipse.exe --clean

3.jar file existence in the root folder,

4.eclipse.ini for lombok entry

 

10. Code Templates

Code templates allow you to insert comments @author @javadoc annotations into your files to make it look nicer for post production of your application.

Go to Preferences -> Java -> Code Style -> Code Templates

code_template


		
	    
		
	

Leave a Reply

Your email address will not be published. Required fields are marked *