Friday, December 23, 2011

Creating Windows Shortcuts for Java Applications

I recently started reading about implementing Selenium Server into my testing process. I quickly downloaded the jar file from their website and opened up my cmd.exe application. While I used the following process for starting Selenium Server, some minor modifications can allow you to shortcut start your programs.

Problem:
I wanted to create a shortcut icon to start Selenium Server to save me a couple of steps.

Solution:
Windows allows easy creation of shortcuts by finding the application, right-clicking, choose Send To => Desktop (create shortcut).

To start, I used this step to create a shortcut to cmd.exe. I used the Start Menu Application Search to easily locate cmd.exe. Once listed, I right-clicked, and created a shortcut on the desktop.


Now I right-click the shortcut and choose Properties. This opens a window that allows me to customize what my shortcut is going to do.



Under the Shortcut Tab, I altered the Target field to read:

C:\Windows\System32\cmd.exe /k java -jar C:\dev\tools\selenium-server-standalone-2.15.0.jar

Now let's break this down. The first part is of course the cmd application that I want to run followed by /k an argument for cmd that tells it to keep the console window open after launching. This is important as our application may give important information to the console or cease to continue running altogether once closed.

Next, I call Java, in my case I have java in my Windows Classpath so that the term java is actually a shortcut to the Java application on my machine. You can read more about setting up java in your system classpath here.

The Java application accepts an argument of -jar which indicates that we are running a compiled jar application. Followed by the application location.

Apply and close any windows remaining, now double click the shortcut icon and hopefully you see something like the following.


Good luck.

Thursday, December 15, 2011

Yum Update Trixbox Issues Dependency Errors

After installing Trixbox on my VirtualBox to mess around with, I noticed that many packages were out of date so I went to update those packages.

Problem:
After typing yum update, yum did it's thing but halted before installing anything with the following message:

Missing Dependency: libcares.so.1 is needed by package sipsak-0.9.6-1.el5.i386 (installed)
Error: Missing Dependency: libcares.so.1 is needed by package sipsak-0.9.6-1.el5.i386 (installed)

Solution:
Your going to have to install these manually before yum will be able to handle them. Use the following commands to download and install these packages.

wget http://download.fedora.redhat.com/pub/epel/5/i386/sipsak-0.9.6-8.el5.i386.rpm
wget http://download.fedora.redhat.com/pub/epel/5/i386/c-ares-1.6.0-2.el5.i386.rpm
rpm -Uhv sipsak-0.9.6-8.el5.i386.rpm c-ares-1.6.0-2.el5.i386.rpm

Workaround:
If you don't have time to deal with these and would prefer to continue installing all other updates, you can tell yum to ignore broken dependencies by using the argument --skip-broken.

yum update --skip-broken

Trixbox 2.8 Adding Repo Addons Breaks GUI

After installing Trixbox 2.8 on my Oracle VirtualBox, I was playing around and enabled the Trixbox Addons repo under Settings > Repositories. Upon refresh my it was apparent that my GUI had been destroyed and I was seeing HTML and a little bit of JavaScript. I began searching for a clue.

Problem: 
Trixbox GUI disappeared upon adding the Addons Repository.

Solutions:
Thanks to some forums, the answer was simple enough.

Open the following file for editing:
/var/www/html/maint/includes/application_top.php

Go to line 137 and past the following line of code:

if(!isset($_SESSION['trixbox_template'])){ $_SESSION['trixbox_template'] = 'default';}

So the file reads as follows:

// Template Chooser
//include('includes/templateChooser.php');
if(!isset($_SESSION['trixbox_template'])){ $_SESSION['trixbox_template'] = 'default';}
//setSession('templateChoice', 'trixbox_template', $sessionFile);

Details:
It appears that updating the repos causes the theme to break by removing the theme currently set in the session. The errors listed by httpd involved missing a slue of css/skin files.

NET: Registered protocol family 2

Well installing Trixbox on my Oracle VirtualBox to play around, my install ran into a problem and halted. I've heard this has happened for other installations on VBox and this solution worked for them.

Problem: 
NET: Registered protocol family 2

Solution:
Luckily a quick search said I needed to enable IO APIC in VirtualBox. Looking around, I found it and my installed proceeded as expected.

Picture:

Under settings, check Enable IO APIC