While programming in Java, there is a frequent requirement to check if an Enum contains a given String value. There are multiple ways to validate this. But I find the EnumUtils class of Apache Commons Lang the most convenient to
How to show line numbers in Eclipse
Although it is seems simple but I’ve seen people struggle with this. Therefore, I decided to put a real quick post on how to show line numbers in Eclipse editor. There are two ways to enable line numbers in Eclipse.
How to set maximum line length in eclipse
To set the maximum line length in Eclipse, open Eclipse and in the menu bar, go to Window -> Preferences and in the pop-up window, go to Java -> Code Style -> Formatter. This will open up the Formatter options
How to change user name in Eclipse code templates
When a new code file is created, the author name in the @author is set to the value which is taken from the user.name environment variable. One way to override this value is to modify the eclipse.ini file. Following are
How to change default HTTP port number in Wildfly
With more than one server installed on a machine, the most common problem is the same HTTP port 8080 being used in all the default server configurations. In this blog I’ll demonstrate how to change default HTTP port number in
How to install Java Decompiler for Eclipse
Often there is a need to decompile third party or standard Java classes to understand their code. But there is no built-in Java decompiler for Eclipse. However there are freely available external plugins which can be installed in Eclipse to
String is immutable in Java
What is an immutable class? An immutable class once instantiated cannot be modified. For example, String is immutable in Java. What is meant by the statement; An immutable class cannot be modified? Let’s try to understand. Once a java.lang.String object
How to enable auto formatting in Eclipse
After creating a custom code formatter in Eclipse, as discussed in my previous post How to create and share Eclipse code style formatter, it is now time to put that code formatter in action. Code formatting should be an automatic
How to solve java.lang.OutOfMemoryError: Java Heap Space
If a program throws the error java.lang.OutOfMemoryError: Java heap space, it simply means that the program while running has exhausted all the heap space and even the garbage collector has not been able to reclaim the heap space from unused
How to increase JVM heap size in Eclipse
As discussed in my blog How to solve java.lang.OutOfMemoryError: Java Heap Space, if a Java program running in Eclipse throws java.lang.OutOfMemoryError: Java heap space, one of the solutions to solve this error is to assign more memory for JVM. Following