Monday, May 22, 2006

Setting up Freemind in Ubuntu Dapper

IMPORTANT
This tutorial is very old, and it has been brought to my attention that it actually is causing more problems than fixing them. I had written this up before there were any other resources of getting Freemind installed on Ubuntu. Anyway you should head on over to http://freemind.sourceforge.net/wiki/index.php/FreeMind_on_Linux to get help on installing FreeMind. Thanks Eric

The Rest of the article will remain intact for posterity.

--------------

Freemind, it's an cross platform java Mind-Mapping application. You might be asking yourself what is a mind mapping application. Here's an quote from the Freemind website:
So you want to write a completely new metaphysics? Why don't you use FreeMind? You have a tool at hand that remarkably resembles the tray slips of Robert Pirsig, described in his sequel to Zen and the Art of Motorcycle Maintenance called Lila. Do you want to refactor your essays in a similar way you would refactor software? Or do you want to keep personal knowledge base, which is easy to manage? Why don't you try FreeMind? Do you want to prioritize, know where you are, where you've been and where you are heading, as Stephen Covey would advise you? Have you tried FreeMind to keep track of all the things that are needed for that?
Now for the new and improved FreeMind installation instructions: We need to make sure we have the universe and multiverse turned on /etc/apt/sources.list for the archive repository

deb http://archive.ubuntu.com/ubuntu/ dapper main
deb http://archive.ubuntu.com/ubuntu/ dapper universe
deb http://archive.ubuntu.com/ubuntu/ dapper multiverse
The FreeMind files are located here
  • Download the main packages
  • freemind_0.8.0-1_all.deb
  • libforms-java_1.0.5-2_all.deb
To install the plugins downlaod these
  • freemind-plugins-help_0.8.0-1_all.deb
  • freemind-plugins-svg_0.8.0-1_all.deb
  • freemind-plugins-time_0.8.0-1_all.deb
Note: the versions numbers might change, or if the page is not available go to the FreeMind site and click on the Debian for Linux link under downloads.

To install FreeMind (we'll get to the plugins a little later) we need to take care of some dependency problems. Install libcommons-lang-java with you favorite package manager. I prefer to use wajig so this is what I will use during the examples. But, if you prefer apt-get replace "wajig" with "sudo apt-get".

wajig install libcommons-lang-java
Now that libcommons-lang-java is installed we can go ahead and install librelaxng-datatype-java

wajig install librelaxng-datatype-java
Next we install libforms-java from the deb package we downloaded

sudo dpkg -i libforms-java_1.0.5-2_all.deb
We now should have all of dependencies we can go ahead and install FreeMind

sudo dpkg -i freemind_0.8.0-1_all.deb
You should now have a working version of FreeMind on you machine. You can test it out by running the following command

/usr/share/freemind/freemind.sh
If all looks good we can continue to install the plug-ins. The plug-ins also have some dependencies which need to be met. Fist lets take care of the dependencies. All but one are located within the repositories. Install the following packages for the SVG plug-in

wajig install rhino libbsf-java
Install the following packages for the time plugin

wajig install j2re1.4 libjcalendar-java
We need to install libbatik-java and I was able to find a deb package here. Download from one of the mirrors and install using dpkg

sudo dpkg -i libbatik-java_1.5.1-1_all.deb
That should take care of our dependency problem, now lets install our plugins

sudo dpkg -i freemind-plugins-help_0.8.0-1_all.deb
sudo dpkg -i freemind-plugins-svg_0.8.0-1_all.deb
sudo dpkg -i freemind-plugins-time_0.8.0-1_all.deb
Now we just need to take care of our associations Create a file called freemind.xml within /usr/share/mime/packages and add the following text

<mime-info>
<mime-type type="application/x-freemind">
<comment xml:lang="en">FreeMind Mindmap</comment>
<glob pattern="*.mm" />
</mime-type>
</mime-info>
Now its time to update the system, enter the following commands

sudo /usr/bin/update-mime-database /usr/share/mime
sudo /usr/bin/update-menus
That should do it. If you check your menu Applications>Office you should see FreeMind and you will also have .mm files associated with FreeMind.

Troubleshooting

Freeming won't start
If you have problems with freemind loading you might want to try this workaround recommended by eiraku in the comments: Edit the startup script to point to the JVM... taken from https://wiki.ubuntu.com/FreeMindInBreezy. Update the start script so FreeMind uses Sun Java. There's probably a more elegant way to make this change, and find the Sun Java path, but this works and I've already spent too much time resolving and documenting this.

sudo vi /usr/share/freemind/freemind.sh
Locate the method findjava() and add the line JAVACMD=/usr/lib/j2re1.5-sun/bin/java as shown below. The path could differ slightly if using a different version of Java.

     elif [ -x /usr/bin/java ]
then
_debug "Using /usr/bin/java to find java virtual machine."
JAVACMD=/usr/bin/java
fi
fi
JAVACMD=/usr/lib/j2re1.5-sun/bin/java
# if we were successful, we return 0 else we complain and return 1
if [ -n "${JAVACMD}" ] && [ -x "${JAVACMD}" ]
then
_debug "Using '$JAVACMD' as java virtual machine..."
Exception in thread “main” java.awt.AWTError
If you an error similar to this
Exception in thread “main” java.awt.AWTError: Cannot load AWT toolkit: gnu.java.awt.peer.gtk.GtkToolkit
at java.awt.Toolkit.getDefaultToolkit(libgcj.so.7)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(libgcj.so.7)
at java.awt.Window.(libgcj.so.7)
at java.awt.Frame.(libgcj.so.7)
at javax.swing.JFrame.(libgcj.so.7)
at freemind.main.FreeMind.(FreeMind.java:93)
at freemind.main.FreeMind.main(FreeMind.java:647)
Caused by: java.lang.ClassNotFoundException: gnu.java.awt.peer.gtk.GtkToolkit
at java.lang.Class.forName(libgcj.so.7)
at java.lang.Class.forName(libgcj.so.7)
at java.awt.Toolkit.getDefaultToolkit(libgcj.so.7)
…6 more
then you should be able to fix this if you type

sudo update-alternatives --config java
and select

/usr/lib/jvm/java-1.5.0-sun/jre/bin/java
you can also use "Galternatives" which is a GUI that does the same as "update-alternatives". Remember to run it as "sudo" or in this case "gksudo" since it's a GUI application. If you need to install it just type

sudo apt-get install galternatives
and after the installation is complete use the following command

gksudo galternatives
Updates
  • 2006/06/01
    • Thanks to *armin* I was able to fix a problem with the deb _source.list_ entries. I've also included the packages for each of the two repositories mentioned in the article.
  • 2006/06/20
    • After reading *432sd's* comment I tried the install from scratch without using the the experimental or unstable repositories from Debian and got it working. So, I've rewritten the article in hopes of making the install cleaner and simpler.
  • 2006/06/29
    • Fixed a typo in the code for the freemind.xml file setup thanks to feedback *Samuel Hilderbrandt*.
  • 2006/08/24
    • Added code changes recommended by eiraku at end of article. Thanks for the info *eiraku*.
  • 2006/11/27
    • Added comments by *Spiro* in the Troubleshooting section. Thanks for the tip.
  • 2007/1/24
    • Fixed typo in freemind.xml text
Resources

[posted with ecto]

6 comments:

  1. Great program, really useful. Just one tiny thing - freemind.xml line 4 should be(?):
    <
    glob pattern="*.mm" /
    >

    Cheers, David

    ReplyDelete
  2. Man that was painful.

    I ran freemind in MandrakeLinux.

    Just uninstall and use. Nothing to it (once Java is installed).

    ReplyDelete
  3. I get many errors; some of the errors you address with suggestions, but those suggestions cause other errors you don't talk about.:

    E: Couldn't find package libcommons-lang-java

    This is a fresh 6.10 install. ideas? I have some *NIX experience and think the su and sudo is under control.

    ReplyDelete
  4. Hello,

    I'm the maintainer of the Linux packages for FreeMind (e.g. Debian/Ubuntu) and your blog raises mixed feelings in me: I recognize the added value of it but two people have already raised issues to me with links to your blog.

    I would really really appreciate if you could redirect people to the official FreeMind on Linux wiki (http://freemind.sourceforge.net/wiki/index.php/FreeMind_on_Linux) and add there your inputs.

    I'm also happy to get the comments/improvements from the Ubuntu community (e.g. the MIME freemind.xml is now part of freemind 0.9.0.beta9), using the Help forum from http://sf.net/projects/freemind

    Thanks, Eric

    ReplyDelete
  5. Ubuntu 7.10 Feisty Fawn
    ================

    This procedure work for me on Ubuntu 7.10 Feisty Fawn, but after all package I need to install one additional package: libgcj7-awt

    NOTE: not tested for plugins.

    ReplyDelete

  6. #######################
    Above-posted solution don't work
    #######################


    Sorry for my previous comment, FreeMind starting OK, but maps looks deformed.

    Instead of libgcj7-awt just install sun-java6-jre (+dependencies).

    When I creating:
    /usr/share/mime/packages/freemind.xml
    as show in the instruction and run:
    sudo /usr/bin/update-mime-database /usr/share/mime
    I've got error:
    * Wrong namespace on document element
    * in '/usr/share/mime/packages/freemind.xml'
    * (should be http://www.freedesktop.org/standards/shared-mime-info)


    I couldn't install Java becouse of above error, so please delete:
    /usr/share/mime/packages/freemind.xml
    and run:
    sudo /usr/bin/update-mime-database /usr/share/mime
    befor you try to install Java.

    For this:
    sudo /usr/bin/update-menus
    I've got:
    sudo: /usr/bin/update-menus: command not found

    ReplyDelete