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…]
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…]
Overview I was working on a Java application that uploads an excel sheet to a web service. The excel sheet is sent as a byte stream. With another webservice I was showing the contents of the excel on the web GUI. Recently I faced an issue, I was able to upload the file to the … [Read more…]
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.
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…]
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…]
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…]