How to install Oracle Java 8 on Ubuntu (in may case, Ubuntu 16.04 LTS) Procedure to install Oracle Java 8 on Ubuntu You probably want to confirm first that a version of Java is not already installed. If so, you can do that with the java -version command as shown below… developer@ubuntu:~$ java -version The program ‘java’ […]

Recently, we experienced some excessive memory consumption that was leading our servers into an out-of-memory (OOM) condition. To troubleshoot the issue, we needed a way to identify any large objects that were filling up the heap. As it turns out, there’s a JVM argument for this. Generic JVM argument: -Xdump:stack:events=allocation,filter If you set this option, whenever […]

When I’m not quite sure how to get exactly what I need out of the request URL, I write some stanza that spits out the value of just about every relevant getter method on the javax.servlet.http.HttpServletRequest object. I’ve done this more than once. To be honest… more than twice – probably three or more times. […]

With Servlet 3.0, it’s now possible to define your servlet using annotations instead of XML in the web deployment descriptor (web.xml). This can simplify maintenance and deployments because it keeps the servlet definition inline with the servlet’s actual code – everything’s conveniently found and managed together in one file. For those of you ready to […]

Did you know there’s a tool that can help you search through JAR files to find Java classes or packages? I’ve been using it for years and I am often surprised that so few Java developers have it in their toolbox. Of course, it’s very handy for resolving those pesky NoClassDefFoundError and ClassNotFoundExceptions, but my […]

A Java ClassNotFound exception does not always mean that a class could not be found on the classpath. It seems that sometimes it can mean that the class was actually found 2 or more times – a conflict in the classloader. Recently, while developing a portlet for WebSphere Portal, I got the following exception: Caused […]

Render the values of a Map The following code snippet shows how to get the values of a Map (e.g. HashMap) from within a Freemarker template. <#assign m = myMap> <#assign values = m?values> <ul> <#list values as myObject> <li>${myObject.myPropery}</li> </#list> </ul> Render the keys of a Map You can do a similar thing with […]

Following are a list of the standard system properties which can be accessed in Java code by using the System.getProperty methods. For example… System.getProperty(“path.separator”); Property Name Description Java Version file.encoding The character encoding for the default locale 1.1 file.encoding.pkg The package that contains the converters that handle converting between local encodings and Unicode 1.1 file.separator […]