Generating random integers using Random().nextInt(int bound)

In this tutorial we see how to generate a random number using the Random class in java and using the method  Random().nextInt(int bound). We will create a class named RandomIntegerGenerator. In this class we will use Random().nextInt(int bound) . It generates a random integer from 0 (inclusive) to bound (exclusive). Here we will set the bound … Read more

Convert a String to an int in Java

How to convert a String to an int in java? The Java Integer wrapper class provides a method parseInt to convert a String to an int.  Here is the method signature: One thing that you will note in the declaration is that the method also throws NumberFormatException.  Just note it for now, we will see below why this exception is … Read more

java.lang.NoClassDefFoundError: Could not initialize class

I was running gwt application on tomcat server and here is the error I encountered. After fighting with this error for some time I resolved this issue by deleting the jax-impl.jar from the tomcat lib folder. It was a possible conflict of the jaxb jar versions with one of my webapps installed in tomcat.

JAXB Tutorial – Hello world

The Java™ Architecture for XML Binding (JAXB) provides an API and tools that automate the mapping between XML documents and Java objects.  The JAXB framework enables developers to perform the following operations and in this JAXB tutorial we will see all of them : Unmarshal XML content into a Java representation Access and update the … Read more

sparx Enterprise architect complaining “You are not connected to version control”

Today a colleague came to me and complained that enterprise architect was not allowing to commit her changes to SVN.  After looking at the EA documentation we found out that EA also has a offline mode. Here is what the EA site says about it “When loading a model that uses version control, Enterprise Architect … Read more

log4j2 issues with maven assembly plugin

I was working on a project and we needed an executable jar will the dependencies in. So I googled and found maven-assembly-plugin. So I took the plugin and used it build my executable jar. After running the executable the log4j2 stopped to work. I tried to build the executable with log4j2.xml in src/main/resources but the … Read more

Privacy Policy

Google adsense use Google adsense to serve ads whenever a visitor comes to this website. Third party vendors, including Google, use cookies to serve ads based on a user’s prior visits to our website. Google’s use of the DoubleClick cookie enables it and its partners to serve ads to our users based on their … Read more