Posts for: #Java

EntityManager with try-with-resource

try-with-resource is the new feature introduced in Java 1.7 to automatically close a resource after using. It basically helps you to avoid a finally block at the end of the try-catch block to close any resource that needs closing like the BufferedReader. But there's a catch. You can not use any type of resource with a try-with-resource block, only those classes that extend java.lang.AutoCloseable can be used, an interface that has a single method:

[Read more]

Automated Package Installation and Configuration Script for Ubuntu

In my last post, I discussed about how I created my first Amazon EC2 instance and ran our Java web server on it. One of the most important things that I have realized over the years is that if you work with a small group of developers, you ought to think about automating certain jobs like testing, deployment, setting up server etc. So that you can concentrate on the real work rather than spending valuable time in doing repetitive tasks. The benefit against spending extra time in writing scripts may not be prominent at first, but over time you will realize the gain in terms of person hours and headaches saved because of the automated scripts.

[Read more]

Running Java app server on AWS EC2 Ubuntu instance

Today I will be writing about setting up an Ubuntu instance on the Amazon AWS cloud and running a Java web application on it. We are working on a hobby project that has its back-end written in Java. The app back-end was first hosted on Heroku but due to some issues, we decided to move it to Amazon AWS. I was given the responsibility to set up our server. This was the first time I had an opportunity to work with Amazon AWS. But it turned out to be quite fun.

[Read more]

[SOLVED] SVN/JavaHL version problem in Ubuntu 13.04 with Eclipse Indigo

I upgraded my Ubuntu from 12.04. Eclipse 3.7 with Subclipse 1.6 was installed in 12.04. Now after upgrading to 13.04, after I start Eclipse and synchronize my project with the repository, it throws the error message: "Incompatible JavaHL library loaded. 1.6.x or later required."

Possible reason: libsvn-java is needed to be installed in Ubuntu in order to make SVN work in Eclipse. The installed version in Ubuntu 12.04 was 1.6 as far as I remember. But after upgrading to 13.04, the libsvn-java version was also upgraded to 1.7. But the version of Subclipse that is compatible with libsvn-java 1.7 is Subclipse 1.8.

[Read more]