Posted in Java on January 6th, 2009 by Nick – 3 Comments
A short rundown on adding external directories to your Apache Tomcat webapp path.
I started with a simple problem and it turns out there’s a simple solution.
My problem:
In the current application I’m coding I display user data (like many apps). Included with the user data, the page also shows the user’s photo. The problem was that the photos were stored in a directory external to Tomcat (D:\photos) and I need to get my webapp access to that directory and have those photos in Tomcat’s path.
My Solution:
To solve this I needed to add what Apache calls a context path which can be done by adding an xml file.
Here’s a bit of given information so this is easier to follow.
- I’m using Tomcat 5.5
- The name of my webapp is called MyProject which is located at $CATALINA_HOME/webapps/MyProject
- The directory I’m trying to add to Tomcat’s path is “D:\photos“
- I want my photos to be accessible in the path $CATALINA_HOME/webapps/MyProject/photos (or http://localhost:8080/MyProject/photos).
Creating the context file:
- In $CATALINA_HOME/conf/[enginename]/[hostname]/ (in my case $CATALINA_HOME/conf/Catalina/localhost/) create a file called “MyProject#photos.xml“. The value before the # is your webapp name and the value after is the path you want added.
- In this file add: <Context docBase=”d:\photos” /> and save.
- Restart Tomcat.
Note for GWT: I can’t seem to get this working with the embedded Tomcat that comes with GWT. If anyone knows a simply way, please let me know. In the mean time I’m using full Tomcat with the noserver option, and for the name of my context file I’m putting the full package name. For example: com.nick.MyProject#photos.xml
Posted in GWT, Linux, Ubuntu on January 2nd, 2009 by Nick – 19 Comments
I’ve recently been working with GWT (Google Web Toolkit) and ran into a small snag configuring it on my Ubuntu 8.10 setup. This will be a short HOW-TO for configuring GWT on Ubuntu or other linux distros. The three topics I’m going to talk about are:
- Getting the hosted browser working in linux
- Dealing with an external browser error when using Compile/Browse
- Adding GWT to the path.
Getting the Hosted Browser Working in Linux
When trying to run using the hosted browser (shell) I got the following exception:
** Unable to load Mozilla for hosted mode **
java.lang.UnsatisfiedLinkError: /home/hellz/projects/gwt-linux-1.5.3
/mozilla-1.7.12/libxpcom.so: libstdc++.so.5:
cannot open shared object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1778)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1674)
at java.lang.Runtime.load0(Runtime.java:770)
at java.lang.System.load(System.java:1005)
at com.google.gwt.dev.shell.moz.MozillaInstall.load(MozillaInstall.java:190)
at com.google.gwt.dev.BootStrapPlatform.init(BootStrapPlatform.java:49)
at com.google.gwt.dev.GWTShell.main(GWTShell.java:354)
The key to troubleshooting the problem is in the second line, libstdc++.so.5 to be exact. It can’t find this C++ library. Turns out the hosted browser needs libstdc++5, but the version currently installed on my 8.10 system is libstdc++6. So you can either:
Open System->Administration->Synaptic Package Manager and install libstdc++5
or
At a console type: sudo apt-get install libstdc++5
Now you should be running in a hosted browser fine.
Error on Compile/Browse
The second issue you might run into is GWT not recognizing your external browser. You’ll know you have this problem after clicking on the Compile/Browse button.

You get an error that looks like:
[ERROR] Unable to find a default external web browser
[WARN] Try setting the environment variable GWT_EXTERNAL_BROWSER to
your web browser executable before launching the GWT shell

The problem is that GWT can’t find your default installed browser (which is most likely firefox). This is easy to fix:
- Open your .bashrc or .profile file, which is located in your home directory. So type gedit ~/.bashrc or nano ~/.bashrc or however else you want to open it. The reason I listed both files is because IMO the environment and pathing system of Ubuntu (and some other distros) is a spiderweb mess. I modified my .bashrc, but I’m not sure if that’s best practice.
- Add this line to the bottom of the file: export GWT_EXTERNAL_BROWSER=/usr/bin/firefox
- Logout and log back in for the changes to take affect.
Now the Compile/Browse button should bring up your external browser.
Adding GWT to the path
Add PATH=”$HOME/projects/gwt-linux-1.5.3:$PATH” to your .bashrc (or .profile) file. Of course you might have to modify the directory name to point where you have GWT installed. For this to take effect you’ll have to logout and log back in as well. You can double check your path to see if GWT has been added by typing echo $PATH. Once you have GWT added to your path you’ll be able to execute projectCreator and applicationCreator from anywhere.
Posted in Linux, Ubuntu on January 1st, 2009 by Nick – Be the first to comment
Most people think they need itunes to manage their ipods. In this post I’ll show how to get audio from your favorite podcast to your ipod using Amarok on linux. Before we start, you need to connect your iPod and make sure it comes up as an Amarok device. If you need help with this refer to Part 1.
Adding the podcast to Amarok.
Before we can get the podcast onto the ipod, we’ll need to add it to Amarok. Here are the steps to accomplish this:
- In Amarok, choose the Playlists tab. You can find this in the set of vertical tabs on the left side.
- Right click on the red folder labeled “Podcasts”
- Select “Add Podcast…”

- Type or paste in the URL of a favorite podcast and click OK. It will then retrieve the podcasts and you’ll see them in that red Podcasts folder. Podcasts are typically taken from a RSS feed so the URL will most likely be an xml file.
Moving the podcast to your ipod.
- From that new list of available podcasts, you can now right click on one of them and choose ” Download Media”. This will download the podcast as an audio file, so depending on how long the podcast is, it may take some time.
- Once the download is complete, you right click on that same podcast again and choose “Transfer to Media Device”. This doesn’t do the actual copy to your ipod, but queues it up for the copy.
- Click on the Devices tab (same left side vertical tabs) and you’ll see everything on your ipod. You’ll also see at the bottom a Transfer Queue, which you should also see your queued podcast.

- Last step is to click on the Transfer button at the top.

You’re done and should now see the podcast in your ipods menu in both Amarok and the ipod itself.

Here are all of the iPods and Amarok posts:
iPods and Amarok, Part 1: Making the Connection
iPods and Amarok, Part 2: Album Cover Art
iPods and Amarok, Part 3: Playlists
iPods and Amarok, Part 4: Podcasts
At the time of this blog, I’m using Ubuntu 8.10 (Intrepid Ibex), Amarok 1.4.10 and an iPod Nano (3rd Gen).
For this example I used a podcast from Clark Howard.
Posted in Linux, Ubuntu on December 31st, 2008 by Nick – Be the first to comment
Creating a playlist for your iPod is one thing that is more intuitive on itunes than Amarok, but once you get schooled it’s pretty simple. Before we start, you need to connect your iPod and make sure it comes up as an Amarok device. If you need help with this refer to Part 1.
Creating a playlist on your iPod using Amarok:
- In the Devices tab, in the left window where it shows all the music on your iPod you’ll see at the very top a red folder labeled “Playlists”. Right-click on that red folder and select “Create Playlist…”, then name the playlist.
- The next step is to add songs to the playlist. In that same left window, right-click on the song or album you want, select “Add to playlist” and select the playlist you are adding to.
Just properly disconnect and unmount your ipod and you’re done.
I mentioned above that itunes has a bit more intuitive of an interface for playlists….let me explain why I think so….
The right side window in Amarok can’t be used at all to manipulate your playlist. You can’t drag, or click and add from there. I think this is a drawback and can be confusing, maybe they’ll change that in Amarok2.
Here are all of the iPods and Amarok posts:
iPods and Amarok, Part 1: Making the Connection
iPods and Amarok, Part 2: Album Cover Art
iPods and Amarok, Part 3: Playlists
iPods and Amarok, Part 4: Podcasts
At the time of this blog, I’m using Ubuntu 8.10 (Intrepid Ibex), Amarok 1.4.10 and an iPod Nano (3rd Gen).
Posted in Linux, Ubuntu on December 30th, 2008 by Nick – 1 Comment
This will be a quick explanation on how to get album covers on your iPod using Amarok. This assumes you’ve already been able to connect to Amarok and copy music successfully. If you have not, then refer to Part 1.
One thing a lot of people don’t know is that you can fetch any album covers you’re missing using Amarok. It can’t hurt to run a fetch, it only takes a couple of minutes, it’s free and it will connect to AmazonMP3 to get all the covers you need for songs that are in your Amarok music library.
To fetch missing album art using Amarok:
- Go to Tools->Cover Manager.
- Click on “Fetch Missing Covers”.
Transferring the album art to you iPod:
- Click on the Devices tab in Amarok and make sure the iPod is connected.
- Click on the iPod button, and use the menu to set your iPod’s model. If you aren’t sure, Apple support site has the info you need.
- In that same iPod menu, click on Update Artwork. Takes just a couple of seconds and you are done.
Now you can browse Iron Maiden albums by cover instead of name on your iPod.
Here are all of the iPods and Amarok posts:
iPods and Amarok, Part 1: Making the Connection
iPods and Amarok, Part 2: Album Cover Art
iPods and Amarok, Part 3: Playlists
iPods and Amarok, Part 4: Podcasts
At the time of this blog, I’m using Ubuntu 8.10 (Intrepid Ibex), Amarok 1.4.10 and an iPod Nano (3rd Gen).