sdk version No command ‘sdk’ found

Got this error while trying to install sdkman on ubuntu:

root@ubuntu:~/.sdkman/bin# sdk version
No command ‘sdk’ found, did you mean:
Command ‘skk’ from package ‘libskk-dev’ (universe)
Command ‘sds’ from package ‘simh’ (universe)
Command ‘sak’ from package ‘seqan-apps’ (universe)
Command ‘sd’ from package ‘sd’ (universe)
Command ‘sdc’ from package ‘hpsockd’ (universe)
Command ‘fdk’ from package ‘plastimatch’ (universe)
Command ‘sdf’ from package ‘sdf’ (universe)
Command ‘sdb’ from package ‘sdb’ (universe)
sdk: command not found
root@ubuntu:~/.sdkman/bin# apt-get update

I issued the following command and it resolved the error:
sudo apt-get install unzip
sudo apt-get install zip
sudo apt-get install sed

and then i reinstalled sdkman
curl -s “” | bash

All was fine.

root@ubuntu:~# sdk version
==== BROADCAST =================================================================
* 09/04/17: Maven 3.5.0 released on SDKMAN! #maven
* 06/04/17: Java 9ea+163 for Mac, Windows and Linux 64 released on SDKMAN! #java
* 04/04/17: Gradle 3.5-rc-3 released on SDKMAN! #gradle

After some time, I was trying to install grails 3.2.8 and then i got this:
root@ubuntu:~# sdk install grails 3.2.8

Downloading: grails 3.2.8

In progress…

curl: (56) GnuTLS recv error (-54): Error in the pull function.
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of /root/.sdkman/archives/ or
/root/.sdkman/archives/, and cannot find /root/.sdkman/archives/, period.

Stop! The archive was corrupt and has been removed! Please try installing again.
root@ubuntu:~# sdk install grails

I installed grails 3.2.7 instead.
SDKMAN 5.5.8+227


unsupported major.minor version

Yet another time to look into the resolution of another uncommon type of error encountered in the java world, the ‘unsupported major.minor version’ error. This error majorly occurs during run-time when the java version that was used to compile a java code into a class is different from the java version being used at run-time.

The solution as has been described in this post is to check for the version of the java being used at run-time and make use of the same java version when recompiling your java code (i used the netbeans IDE). Lets take an example of the error message in this way:

unsupported major.minor version 51.0

This message is simply saying the the java version needed is 1.5 and this is contrary to the version found in your application.

How do we resolve the error using the netbeans IDE.

1. Make sure the project is selected in netbeans and then press the ‘F11’ key, it should give you a box as shown below.

netbeans f11

2. Click on Project Properties in the above box, it should give you the box below

netbeans jdk change

3. Change the Source/Binary format (right at the lower part) to the one required and click the ‘ok’ button to save your changes, here I have changed it to version 1.5 as specified in the error. The warning message below should be ignored:

warning: [options] bootstrap class path not set in conjunction with -source 1.6

1 warning

4.You can then recompile and go run your application again.

Installing and Deploying a war file in tomcat

1. Download apache-tomcat-7.0.28 or the latest version from :
2. Place the downloaded zip file in any location and uzip it, in my case I placed it in the location shown below.
3. Navigate to the bin folder as shown below
4. Launch the startup.bat file (for windows) and you should get a screen as shown below:

Tomcat startup screen

5. From the browser, input the url:

A screen like this should appear:

Tomcat Manager
6. To deploy a .war file, click the Manager App button as shown by the arrow above but you would need to set up a username and password for the manager.
7a. To set the username and password for the manager, navigate to tomcat-users file as shown in the link below:

b.Paste the line below where you have a commented list of user tags. You can also uncomment the tags:
<role rolename=”manager-gui”/>
<user username=”tomcat” password=”s3cret” roles=”manager-gui”/>
Here is a full content of the role tags aspect of tomcat-users.xml
<role rolename=”tomcat”/>
<role rolename=”role1″/>
<user username=”tomcat” password=”tomcat” roles=”tomcat”/>
<user username=”both” password=”tomcat” roles=”tomcat,role1″/>
<user username=”role1″ password=”tomcat” roles=”role1″/>
<role rolename=”manager-gui”/>
<user username=”tomcat” password=”s3cret” roles=”manager-gui”/>

8. Restart Tomcat and input the link below in the browser:

9. Click on the ‘Choose file’ Button This would manage the upload of your war file

Deploying war file
10. To deploy a war file, click the Choose file button as shown above. This will prompt you to upload the war file you want to deploy.

11. Click the deploy button
Your war file will be deployed and can be referenced from the browser using:


Your comments and observations will be highly appreciated.


Spring Error

In an event you encounter an error as below in the development of a spring application with STS; you can find the solution as stated.


Exception in thread “main” org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 14 in XML document from class path resource [META-INF/spring/app-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException: The prefix “p” for attribute “p:messageProvider-ref” associated with an element type “bean” is not bound.
(AbstractXmlApplicationContext.ja va:92)
Caused by: org.xml.sax.SAXParseException: The prefix “p” for attribute “p:messageProvider-ref” associated with an element type “bean” is not bound.
… 14 more

To resolve this problem, the line below would have to be included in the xml schema definition in the first few lines of your xml file (in my case app-context.xml)

so i have the first 5 lines of my xml file to be this:
<?xml version=”1.0″ encoding=”UTF-8″?>
<beans xmlns=”;

*This works fine.

Some Spring mvc errors and solutions

Below are some of the errors you are likely to encounter in eclipse when developing a spring mvc applications. The solution to the errors have been made in bold letters below each.

INFO: Loading XML bean definitions from file [C:\Utilities\Eklipse\SpringDemo\spring.xml]
Exception in thread “main” org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 2 in XML document from file [C:\Utilities\Eklipse\SpringDemo\spring.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element ‘beans’.
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(
at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(
at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(
at com.tunji.dkreators.DemoMain.main(
Caused by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element ‘beans’.
at Source)
at Source)
at Source)
at Source)
at Source)
at Source)
at Source)
at$NSContentDriver.scanRootElementHook(Unknown Source)
at$ Source)
at$ Source)
at Source)
at Source)
at Source)
at Source)
at Source)
at Source)
at Source)
at Source)
at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(
… 5 more
What does it mean when you get an error like this in spring framework development

Ans: If you look critically at the ‘Caused by’ section, it simply means either you did not create an xml file you have decleared in your main file
and so it could not be found during the running process.

“Caused by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element ‘beans’.”

Kindly create the xml file.
2. INFO: Refreshing startup date [Tue May 29 06:42:18 PDT 2012]; root of context hierarchy
May 29, 2012 6:42:19 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [spring.xml]
Exception in thread “main” org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [spring.xml]; nested exception is class path resource [spring.xml] cannot be opened because it does not exist
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(
at com.tunji.dkreators.DemoMain.main(
Caused by: class path resource [spring.xml] cannot be opened because it does not exist
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(
… 13 more

Ans: This simply means you have to create or move your xml file into the classpath which is usually the src folder.


Hope you found this useful.

A Comment on Chad Fowler’s Book

After reading Chad Fowler’s book, titled ‘My job went to India…’, I decided to put up this piece about the author. Simply put, Chad is someone that has a good understanding of the Information Communication Technology world; his book answered a lot of questions that most newbies and even experienced programmers or developers of today would often ask.

Apart from this book which is enriched with the analysis of the author’s practical experience in India, he also has a publication titled ‘The passionate programmer’ and some others on the Ruby programming language.

This book is a must read for all, especially in the ICT industry, and in essence, not all about reading but putting to use the practical ideas that were given.

Android Currency USD to NGN naira converter

Getting ones and on an android application development feels good sometimes, especially when you have been able to scale through the hurdles of the initial setup of eclipse.

Here we have a simple android application that converts the US dollars to the Nigerian naira. Although the rates are currently being hard-coded, an upgrade is going on to fetch them online and that would be released soon. And this application could also be enhanced to convert in more than one currency.

Going through the process of the development of this application, although so much dependent on an existing example, in a way I thought there was no need putting it on my blog but on another note I felt it would be a good platform for  android newbies to move a step further.

Now go on with me to the next step as I explain an easy way of achieving this or even something greater.


1.       Get eclipse IDE(Integrated Development Environment) installed on your system

I have had ,Eclipse Java EE IDE for Web Developers. Version: Helios Service Release 2 Build id: 20110218-0911’ on my system for some time now and believe me, it has really being a great tool to work with having used it for a lot of developments out of android. In building this application all I needed to do was to complete the needed setup for the android part of eclipse and then was I able to fire on with my development. You might decide not to use eclipse for your own development, but giving it a trial is not in any way bad as well. To download and install eclipse, this is the link.

2.       Get Android installed and configured.

After you have downloaded the needed version of eclipse( usually Eclipse Classic 3.5 (Galileo)) the next step is to go ahead and make the necessary android installation and configuration. The link below should help you in doing that.   Please note that for people in countries like Nigeria in which people do not really have extremely fast bandwith, there might be some challenges in achieving the first two steps above and I bet you, one might not be able to move a step further without getting them set.  

3.       Set up an emulator

The purpose of this is to be able to test you application during and after development and see it the way it would work on an android appliance.

4.       Make your application

Depending on the complexity of the app you want to develop, which I believe should not be complicated at this time, eclipse  avails you the opportunity to easily get an application built in no time.   In eclipse, create a new android project and paste the code below into the script below into the res/layout/main.xml file .  

<?xml version=“1.0” encoding=“utf-8”?>












android:orientation=“vertical” >






android:hint=“USD” />






android:textSize=“18sp” />






android:textSize=“18sp” />






android:textSize=“18sp” />




android:layout_height=“80dp” >





android:text=“USD to NGN” />





android:text=“NGN to USD” />








android:text=“Convert” />



After that, copy the following code and paste it in a default java file that eclipse created.  


import android.*;


import android.view.View;

import android.view.View.OnClickListener;

import android.widget.Button;

import android.widget.RadioButton;

import android.widget.TextView;

import android.os.Bundle;

public class CurrencyActivity extends Activity implements OnClickListener {

TextView dollars;

TextView naira;

RadioButton dton;

RadioButton ntod;

Button convert;

/** Called when the activity is first created. */


public void onCreate(Bundle icicle) {



dollars = (TextView)this.findViewById(;

naira = (TextView)this.findViewById(;

dton = (RadioButton)this.findViewById(;


ntod = (RadioButton)this.findViewById(;

convert = (Button)this.findViewById(;



public void onClick(View v) {

if (dton.isChecked()) {



if (ntod.isChecked()) {




protected void convertDollarsToNaira() {

double val = Double.parseDouble(dollars.getText().toString());

// in a real app, we’d get this off the ‘net



protected void convertNairaToDollars() {

double val = Double.parseDouble(naira.getText().toString());

// in a real app, we’d get this off the ‘net




5.       Run your application and view your application if there are no hitches.

Although there is a slim chance of everything working smoothly at the very first attempt, here are some links below that could assist in some of the challenges you face. It is however important that you find out what a problem is by searching and reading about the error messages or logs before you start troubleshooting. Else, you might end up muddling up all the application and not knowing where to go from there. I hope this helps, please post your comments and observations and let me know if this helps you. I am also available to assist further if you are experiencing some other forms of challenges as regards this.  


Dogs barking simple java simulation

Just thought of what to do today and i came up with this simple java code that barks at me when i run it.

Mind you, considering the need for simplicity, the barking has being made in terms of words and not a sound format which is also achievable as might be posted in the future. Below is my code and feel free to make comments, add or subtract from it as you wish.


class Dog{

int size;
String breed;
String name;
boolean healthy;

void bark(){
System.out.println(“ruff! ruff!!”);

class DogTest{  //this could be saved as another class.

public static void main(String[]args){
Dog c = new Dog();
c.size = 40;
c.breed = “bull”; = “coaster”;
c.healthy = true;




Installation of the JDK on a RedHat Linux System

Installing the JDK on a RedHat Linux System

Today, i feel i should share a solution to another very important process that causes some hitches especially for coders and developers that are to a certain extent upcoming.

It is about the simple java installation on linux redhat.

Ordinarily on a newly installed Redhat Linux server, you might not get a java installation that you desire or even none at all. If you are in such a position then i am happy you got to this blog.

In this post I will describe how to install a JDK on your RedHat Linux server. It should also work on Fedora, however I have not tried it personally.

1. First we need to download a JDK. I am downloading JDK 6u1 from
Go to that page and click the Download button. On the new page that loads, we will download the Linux RPM in self-extracting file. You can contact me if you are having a challenge doing that.
2. Once you have downloaded your file, and have it placed somewhere on your Linux box (I put mine in /root/jdk), we will extract and install it. The name of the file I downloaded was jdk-6u1-linux-i586-rpm.bin.
3. Login to your Linux box as the root user, and change directory to where you placed the jdk file that you downloaded.
4. Make sure the file you downloaded is executable.

chmod 755 jdk-6u1-linux-i586-rpm.bin

5. Now run the file.


6. A license agreement will appear on your screen displayed through the more command.
Simply press the enter key until you get to the end, or just press the q key to skip right to the end.
7. At the end of the agreement, type yes to agree to it and continue with the install.
8. The JDK will now unpack and install itself. Your screen output should look similar to the following:

UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (
inflating: jdk-6u1-linux-i586.rpm
Preparing… ########################################### [100%]
1:jdk ########################################### [100%]
Unpacking JAR files…


9. The install routine installs the files into the directory /usr/java/jdk1.6.0_01. It also creates two links in that directory named default and latest.
It’s about time Sun has done this. I have been manually doing something like this since the JDK 1.2 days.
These links make it easy to migrate to a new JVM, as you would reference the link in your shell scripts and not the actual JVM directory itself.
10. Now we want our system to automatically put the JDK binary files into our PATH when we login for all users.
To do this, edit the /etc/profile file and place the following two lines at the bottom of your file:

JAVA_HOME=/usr/java/default; export JAVA_HOME

11. Now if you logout of your system and then log back in, you should be able to run the java command to print its version. Run the following command:

java -version

And your output should look like:

java version “1.6.0_01”
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)

12. Congratulations, your JDK is installed!



Java program to read and sort figures from a text file

package com.tunji.coursera;

/*This program collects integers and sorts them in either ascending or
descending order as picked in the options given.
There is a need for an enhancement for the program to pick the arrays from
a text file. */

import java.util.*;

public class PickSortMerge {

public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new FileReader(“C:\\Utilities\\Textpad programs\\com\\tunji\\coursera\\numbers.txt”));
Map<String, String> map=new TreeMap<String, String>();
String line=””;
FileWriter writer = new FileWriter(“C:\\Utilities\\Textpad programs\\com\\tunji\\coursera\\pro.txt”);
for(String val : map.values()){

private static String getField(String line) {
return line.split(” “)[0];//extract value you want to sort on