How to measure the time spent on methods execution in Java

In this tutorial we will show how to measure the time spent on the execution of a Java method by using Byteman tool. There are several tools or product which can trace the execution of Java methods and calculate how much time you are spending in the single methods of your application. This is a … Read more

Simple strategies to test your Java applications with LDAP

LDAP is commonly used in Security realms as a source of authentication and authorization information. This tutorial will teach you two simple strategies for starting an LDAP Server in minutes in order to secure your Enterprise applications. Option 1: Use an Embedded LDAP Server The first example is using an embedded ApacheDS LDAP server with … Read more

How to find out which JAXB implementation is used in your code

When using WildFly or JBoss EAP, the JAXB implementation is defined by the following specification in module.xml: <module name=”javax.xml.bind.api” xmlns=”urn:jboss:module:1.7″> <dependencies> <module name=”javax.activation.api” export=”true”/> <module name=”javax.xml.stream.api”/> <module name=”com.sun.xml.bind” services=”import”/> <module name=”javax.api”/> </dependencies> <resources> <resource-root path=”jboss-jaxb-api_2.3_spec-1.0.1.Final-redhat-1.jar”/> </resources> </module>  In order to check the actual JAXB implementation, you can just create a new Instance of JAXBContext and … Read more

How to solve java.lang.OutOfMemoryError: GC overhead limit exceeded

The error “java.lang.OutOfMemoryError: GC overhead limit exceeded” is fairly common for old JDK (mostly JDK 1.6 and JDK 1.7) . Let’see how to solve it. According to the JDK Troubleshooting guide, the “java.lang.OutOfMemoryError: GC overhead” limit exceeded indicates that the garbage collector is running all the time and Java program is making very slow progress. … Read more

Getting started with Java-based Machine Learning Libraries

There are over 70 Java-based open source machine learning projects listed on the MLOSS.org website, and probably many more unlisted projects live at university servers, GitHub, or Bitbucket. In this article, we will review the major libraries and platforms, the kind of problems they can solve, the algorithms they support, and the kind of data they can work with. … Read more

How to kill a Java process from Java

Today I had to write a quick code to find out which Java process is using a Port and eventually killed it. You can use it as template in case you have to manage OS process in Linux from Java code: import java.io.BufferedReader; import java.io.InputStreamReader; public class Execute { public static void main(String[] args) { … Read more