Archive for the ‘java’ Category /usr/lib/ error on Debian Wheezy

Saturday, July 16th, 2011


this should have been fixed by



I came across this error the other day running a java application on Debian Wheezy: Could not initialize NSS
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
at java.lang.reflect.Constructor.newInstance(
at Method)
at jd.http.XTrustProvider.install(
at jd.http.Browser.init(
at jd.update.Main.main(
Caused by: /usr/lib/
… 18 more
ERROR Could not initialize NSS

Apparently an update broke the configuration of the OpenJDK installation. So to fix it I had to manually edit the file /etc/java-6-openjdk/security/nss.cfg:

name = NSS
#nssLibraryDirectory = /usr/lib
nssLibraryDirectory = /usr/lib/i386-linux-gnu
nssDbMode = noDb
attributes = compatibility

Commenting out the highlighted orange line and adding the highlighted green line. The reason of it is that OpenJDK has split this configuration according to the box architecture (see However on my box it failed updating the reference to the new location of the file (I am on Debian Wheezy which is not stable yet so I guess something went wrong).

Restore deleted folder in SVN after commit

Saturday, January 29th, 2011

If you delete a remote folder in SVN accidentally it gets tricky to restore it back. This can happen by commiting an unwanted deletion. So, basically, what you have to do is:

  • Create a working copy of the deleted folder’s parent. You can use -N parameter that indicates “No checkout”. This will prevent from actually downloading any code. Run:

svn co -N SVN_PARENT_URL .

  • Get a copy of the deleted folder from the revision before the deletion. Run:


  • Commit to HEAD. This will actually commit a new revision with the contents of the revision before the deletion. Therefore restoring the “original” folder. Run:

svn commit -m “Restoring” DELETED_FOLDER_NAME



Squirrel SQL: Universal SQL Client

Saturday, November 13th, 2010

Squirrel SQL ( is an open-source software developed with Java to manage databases. This means:

  • you can control as many DBs as JDBC drivers exists out there (MySQL, Oracle, Postgresql, etc, etc.)
  • you can run it in Linux, MacOS, Windows, etc, etc.
  • it’s free.

graph Squirrel SQL: Universal SQL Client

Check complete features and screenshots here.

Apache Cassandra with Java

Thursday, May 6th, 2010

Excelent tutorial for Apache Cassandra by Ronald Mathies of Sodeso.

Edit: links are dead :(

Phase Relationships in the Standardization Process

Tuesday, April 13th, 2010

A bit sarcastic yet almost-always-true article written by James Gosling in 1990 (20 years ago), about politics in the software development industry.


Anemic Domain Models

Saturday, February 13th, 2010

A post by Martin Fowler that talks about a very common and used way of defining the domain layer and service layer in an application.

Some quality reading…

Tuesday, January 26th, 2010

Thanks, Jorge!

App installers for Java

Wednesday, November 11th, 2009

IzPack is a one-stop solution for packaging, distributing and deploying applications.

It is fully cross-platform and generates a single installer. As such, it is an alternative to native solutions such as platform-specific installers and package managers.

IzPack-generated installers only require a Java virtual machine to run.

Further on:

5 days of Apache Wicket

Wednesday, October 28th, 2009

5 days of Wicket!


2 amazing books I am reading rigth now

Saturday, October 3rd, 2009

These are 2 amazing books I am reading right now.

  • Head First Design Patterns
  • Wicket In Action

I post here the Amazon links, feel free to use them.


Remember Goto statement?

Thursday, September 3rd, 2009

One programmer in anger says to the second programmer:
- “Go to Hell!”

The second programmer replies, in obvious repulsion:
- “Ugh, you used goto!”


Non Relational DB: The (near?) future of databases.

Saturday, July 25th, 2009


“Neo4j is a graph database. It is an embedded, disk-based, fully transactional Java persistence engine that stores data structured in graphs rather than in tables. A graph (mathematical lingo for a network) is a flexible data structure that allows a more agile and rapid style of development.
Neo4j has been in commercial development for 8 years and in production for over 5 years. It is a mature and robust graph database[...]
In addition, Neo4j includes the usual database features: ACID transactions, durable persistence, concurrency control, transaction recovery, and everything else you’d expect from an enterprise-strength database.[...]“


“MongoDB is a high-performance, open source, schema-free document-oriented database.[...]
When we describe MongoDB as “document oriented”, we mean it’s in the class of databases for which the primary storage unit is a collection – possibly structured – of data, most likely as key/value pairs.”


“Hypertable is an open source project based on published best practices and our own experience in solving large-scale data-intensive tasks. Our goal is to bring the benefits of new levels of both performance and scale to many data-driven businesses who are currently limited by previous-generation platforms.”


“Unlike a relational database, Dynamo is a distributed storage system. Like a relational database it is stores information to be retrieved, but it does not break the data into tables. Instead all objects are stored and looked up via a key.”

Extra info:

Eclipse 3.4 Show and Hide Breadcrumbs

Thursday, June 18th, 2009

Eclipse 3.4 Ganymede comes with a very handy Breadcrumbs Navigator which creates a breadcrumb above the source code editor. To open it, right click on the Java Editor and choose “Show in Breadcrumb”. Or simply toggle this navigator with the toolbar button:

eclipse breadcrumb Eclipse 3.4 Show and Hide Breadcrumbs
For those of you who are unaware of what breadcrumbs do, it is navigation aid used in user interfaces. The term breadcrumbs comes from the trail of breadcrumbs left by Hansel and Gretal in the famous fairytale. It is a method for users to keep track of their locations in programs or documents.

Interesting way of defining Java exceptions

Thursday, May 28th, 2009
ArithmeticException You are trying to use your computer to solve a mathematical problem that you cannot solve yourself. Read up on your arithmetics and try again.
ArrayIndexOutOfBoundsException See IndexOutOfBoundsException. The difference is that this exception refers to more than one finger.
ArrayStoreException You have used all your arrays and need to buy more from the array store.
ClassCastException You need to stay in the class or caste you were born into. Java will not accept dailits acting as kshatriyas or noblemen pretending to be working class. Note the spelling mistake (of caste) that was introduced in Java 1.0 and has not been corrected for backwards compatability reasons.
ClassNotFoundException You seem to have invented your own class. There are also caste systems that are not yet implemented in Java, most notibly the balinese caste system. For example, if you are a wesia, use the indian counterpart vaishya.
CloneNotSupportedException You are a clone. Find the original you, tell him what you want to do and then kill yourself.
IllegalAccessException You are a burgler that are running a Java program during a burglery. Please finish stealing the computer, leave the premises and try again.
IllegalArgumentException You have tried to protest against a previous exception.
IllegalMonitorStateException Please turn your computer screen back on.
IllegalStateException You come from a state that is not yet recognized by the UN, possibly Kurdistan or Palestine. Get a real citizenship, recompile your java code and try again.
IllegalThreadStateException One of the screws in your computer is threaded the wrong way. Please contact your hardware vendor.
IndexOutOfBoundsException You have put your index finger in an unacceptable place. Reposition it and try again.
InstantiationException Not everything can happen instantly. Please be more patient.
InterruptedException Tell your colleagues, room-mates etc. to leave you alone while you are working.
NegativeArraySizeException You have created an array with negative size. This can cause information to be lost and in the long run the Universe will be destroyed. Be happy that Java noticed what you were doing and DON’T DO IT AGAIN.
NoSuchFieldException You are trying to have a picknick on a field that does not exist. You can also get this exception if you try to visit an airfield that in fact does exist, but has been classified as top-secret. I’d give you examples, but then I’d have to kill you.
NoSuchMethodException Don’t use that method! Please, do things like we have always done.
NullPointerException You do not own a dog. Get one, for example a brittany spaniel, and try again.
NumberFormatException You are using outdated units of measurement, for example inches or pints. Convert to SI. There is a known bug that causes this exception to be thrown if you are very short or tall.
RuntimeException You cannot run fast enough, possibly due to obesity. Turn off your computer and go out and get some exercise.
SecurityException You have been deemed a threat to nationaly security. Please sit still and wait for the authorities to come and get you.
StringIndexOutOfBoundsException Your panties have shiften out of place. Adjust them and try again. You can also get this exception if you are not wearing any panties at all.
UnsupportedOperationException You are trying to have an operation that for some reason, ethical or otherwise, is not supported by Java. Examples of this include unneeded amputations, for example circumcisions. Please stop abusing your body and do not remove pieces of you child, damn it!

See more at:

Using SVN with Subclipse

Saturday, May 2nd, 2009

If you want to know the basics of SVN with Subclipse there’s no need to add anymore than what this article already says.

Was really helpful and clear to me.

Java with GUTs

Wednesday, April 15th, 2009

This is a great article on writing unit tests. It will give you a lot of background information and further reading links, as well as different points-of-view and opinions.

Part 1:
Part 2:

Enjoy it!

Install Apache's Tomcat 6

Sunday, August 10th, 2008

This is extracted from RUNNING.txt file of Apache’s Tomcat 6 distribution. I think it is pretty straight-forward, so there’s nothing else I should add here.

Running The Apache Tomcat 6.0 Servlet/JSP Container
Apache Tomcat 6.0 requires the Java 2 Standard Edition Runtime
Environment (JRE) version 5.0 or later.

Running With JRE 5.0 Or Later
(1) Download and Install the J2SE Runtime Environment (JRE)

(1.1) Download the Java 2 Standard Edition Runtime Environment (JRE),
release version 5.0 or later, from

(1.2) Install the JRE according to the instructions included with the

(1.3) Set an environment variable named JRE_HOME to the pathname of
the directory into which you installed the JRE, e.g. c:\jre5.0
or /usr/local/java/jre5.0.

NOTE: You may also use the full JDK rather than just the JRE. In this
case set your JAVA_HOME environment variable to the pathname of
the directory into which you installed the JDK, e.g. c:\j2sdk5.0
or /usr/local/java/j2sdk5.0.

(2) Download and Install the Tomcat Binary Distribution

NOTE:  As an alternative to downloading a binary distribution, you can create
your own from the Tomcat source repository, as described in “BUILDING.txt”.
If you do this, the value to use for “${catalina.home}” will be the “dist”
subdirectory of your source distribution.

(2.1) Download a binary distribution of Tomcat from:

(2.2) Unpack the binary distribution into a convenient location so that the
distribution resides in its own directory (conventionally named
“apache-tomcat-[version]“).  For the purposes of the remainder of this document,
the symbolic name “$CATALINA_HOME” is used to refer to the full
pathname of the release directory.

(3) Start Up Tomcat

(3.1) Tomcat can be started by executing the following commands:
$CATALINA_HOME\bin\startup.bat          (Windows)
$CATALINA_HOME/bin/           (Unix)

(3.2) After startup, the default web applications included with Tomcat will be
available by visiting:      http://localhost:8080/

(3.3) Further information about configuring and running Tomcat can be found in
the documentation included here, as well as on the Tomcat web site:

(4) Shut Down Tomcat

(4.1) Tomcat can be shut down by executing the following command:
$CATALINA_HOME\bin\shutdown            (Windows)
$CATALINA_HOME/bin/         (Unix)

Develop J2ME apps in Ubuntu with Eclipse, EclipseME & Sun Java Wireless Toolkit 2.5.2

Tuesday, June 24th, 2008

1-Download Sun’s Java Wireless Toolkit 2.5.2:

2-Install dependencies (found in the previous link):

yo@notebook# sudo apt-get install libxpm-dev libxt-dev libx11-dev libice-dev libsm-dev libc6-dev libstdc++6-dev

3-Install Sun’s Java Wireless Toolkit 2.5.2. Go to the dir were you downloaded the installer:

yo@notebook# chmod +x sun_java_wireless_toolkit-2_5_2-linux.bin
yo@notebook# ./sun_java_wireless_toolkit-2_5_2-linux.bin

You must enter the location of the JVM (I’m using JDK6 and it is located in /usr/lib/jvm/java-6-sun/bin/) and select a destination dir.

4-Install EclipseME plugin using the instructions found in:

They work perfectly!

5-Now go develop some cool app for your mobile :-)