Saturday, January 16, 2010

Changing nickname in Irssi

I usually use Colloquy on my Mac (OS X Snow Leopard), but when I couldn't get it to connect to irc.codehaus.org so that I could get into the #camel room, I decided to fall back to Irssi. I installed it via MacPorts and started it up via the normal command line prompt:

bash_prompt$: irssi

and tried to connect:

/connect irc.codehaus.org

However, I kept getting the following message:

11:00 -!- Irssi: Looking up irc.codehaus.org
11:00 -!- Irssi: Connecting to irc.codehaus.org [63.246.7.185] port 6667
11:00 -!- Irssi: Connection to irc.codehaus.org established
11:00 -!- Irssi: Connection lost to irc.codehaus.org
11:00 -!- jessieberlin Erroneous nickname

I tried to change my nickname inside the Irssi application:

/nick jessie

but was told:

11:02 -!- Irssi: Not connected to server

However, I was able to connect by passing in my alternate nickname as a command line option when starting up Irssi:

irssi --nick=jessie

and then connect normally:

/connect irc.codehaus.org

[Changing my nickname before connecting via Colloquy still didn't allow me to connect - not really sure what I am doing wrong there]

Hopefully this will help some other irc/Irssi newbies.

Sunday, January 3, 2010

Playing around with Apache Camel on Ubuntu, Part 1: Setup

OS: Ubuntu 9.10

On the Developer's Building Page, it states that Java 1.5 is a requirement for building Apache Camel. The J2SE 5.0 reached its End of Service Life Nov. 3rd, 2009, but the required file can be found as the JDK 5.0 with Java EE on Sun's Java SE Downloads - Previous Release - J2SE 5.0 page.

I downloaded and put the java_ee_sdk-5_01-linux.bin file near my camel source code, but I didn't know exactly what I was supposed to do with it (since I have java 6 installed) until I tried to do a mvn install in the camel directory. When I tried to do a build, I got a message like this from maven:

Missing:
1) com.sun:tools:jar:1.5.0
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=com.sun -DartifactId=tools -Dversion=1.5.0 -Dpackaging=jar -Dfile=/path/to/file

I ran that command using the path to the java_ee_sdk-5_01-linux.bin file, and it seemed to build fine. It also put a tools-1.5.0.jar file in /root/.m2/repository/com/sun/tools/1.5.0/.

I thought that, having installed the jar file there, maven would know where to find it next time around. However, it didn't work that way. The next time I did mvn install, I got the same missing message:

Missing:
1) com.sun:tools:jar:1.5.0
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=com.sun -DartifactId=tools -Dversion=1.5.0 -Dpackaging=jar -Dfile=/path/to/file

I started trying to play around with the pom.xml files as described here, and got it to partially build, but then it started complaining about the maven plugin pom.xml files ....

Long story short, that jar file had to be renamed and placed in my ${java.home}/.../lib directory with the name "tools.jar". However, ${java.home} does not refer to the $JAVA_HOME environment variable. It refers to your installation directory, which apparently cannot be set as an environment variable (forgive my ignorance on such topics). In order to set it to the right installation directory (sun's - it won't work if you put it in the openjdk directory), I had to run:

sudo update-alternatives --config java

Which brings up something like the following:

There are 4 choices for the alternative java (providing /usr/bin/java).

Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 auto mode
1 /usr/bin/gij-4.3 43 manual mode
2 /usr/bin/gij-4.4 1044 manual mode
3 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 manual mode
* 4 /usr/lib/jvm/java-6-sun/jre/bin/java 63 manual mode

Press enter to keep the current choice[*], or type selection number:

For me, 0 was initially selected. I selected 4, and placed copied the tools-1.5.0.jar from the
/root/.m2/repository/com/sun/tools/1.5.0/ directory and placed it as tools.jar inside of /usr/lib/jvm/java-6-sun/jre/lib/

This time it built. It is now running all the tests, because I was silly and didn't tell it not to (mvn -Dtest=false -DfailIfNoTests=false clean install).

Update: It will report BUILD FAILURE if any of the tests fail, even if the build itself was successful.

Update #2: Turns out I am just inept and didn't make sure I was using sun's java. Builds pretty well when using sun's java.