FreeMind is a free mind-mapping software written in Java. In this post I will show how to export FreeMind mind maps as Java Applet, describe issues which you can encounter during this process and give some hints on a how to better package exported mind maps.
Let’s start with creating a test mind map. Suppose we have the following mind map:
FreeMind has plenty of options for exporting mind maps. For example the image which you see above was created using Export as PNG option (File -> Export -> As PNG…). Your next question might be: Why to export mind maps as Java Applet if there are so many other options? Here is the answer. Even if FreeMind has many options for exporting mind maps, most of them are not suitable for publishing on the Internet (especially for big mind maps). Starting with FreeMind 0.9.0 two new export options were added: Flash and Java Applet. These two options can be used to bring mind maps into the Internet.
The difference between these two is that Java Applet looks exactly like maps on the screen of FreeMind but needs longer to be loaded (This can be fixed by deploying the Java Applet using Java Web Start technology. I will describe how it can be done below.). Flash application is very fast but it has a totally different look and feel and doesn’t support rich formatted text. You can see here how it looks like:
There a two ways for exporting mind maps as Java Applet:
- Using FreeMind export menu. Go to File -> Export -> As Java Applet… and choose the destination file name, let’s say Test.html. After clicking OK go to the directory where you saved the file. You will see the Test.html file and a Test.html_files directory. Here, there is a small issue, at least in my case. In order to make it work, you have to edit Test.html file and specify the page title. Replace the tag <title/> with <title>Test Mind Map</title>. That’s it, save the file and open it in the browser. Now the applet should start.
You will find quickly that images which are used in the mind map itself (inserted using option Insert -> Image…) are not displayed by the applet. This is because images were not exported together with the map. In order to fix this you have to follow the following rules:
- Store all the images used inside your mind map in one directory (e.g. files or images) which is located in the same directory with mind map file (*.mm). This will ensure that all the paths to images are relative (e.g. files/image1.png).
- After the export, manually copy the directory with all the images used in your mind map to same location where mind map file (*.mm) resides. In our case Test.html_files.
- Manually. As you can see from the previous option, there are many manual steps to do in order to make it work. Due to this you can consider to configure the FreeMind Browser Applet manually. This is not complicated at all. You can find preconfigured templates at $FREEMIND_HOME/browse where $FREEMIND_HOME is the home directory of FreeMind. The only thing you have to change is the following line:
Put your mind map file instead of freemind.mm and you are done. Also don’t forget about images. In case you are using images inside your mind map the procedure is the same one as described in previous topic.<param name="browsemode_initial_map" value="./freemind.mm">
Now it’s time to deploy the Applet on Internet. First problem which you will encounter trying to deploy the Applet is what to do with the images. It’s not very comfortable to carry all these images one by one and upload them. In order to solve this problem, we can package our mind map file (*.mm) together with all the images as one jar file. Run the following command inside the directory where mind map file is located (we assume that directory with images is located also there):
jar –cvf test-mm-freemind.jar *
After this, change the HTML applet tag as follows:
<applet code="freemind.main.FreeMindApplet.class" width="100%" height="100%"
archive="https://sites.google.com/site/azagorneanu/freemind/freemind-browser.jar,https://sites.google.com/site/azagorneanu/mm/test/test-mm-freemind.jar">
<param name="type" value="application/x-java-applet;version=1.4">
<param name="scriptable" value="false">
<param name="modes" value="freemind.modes.browsemode.BrowseMode">
<param name="browsemode_initial_map"
value="jar:https://sites.google.com/site/azagorneanu/mm/test/test-mm-freemind.jar!/test.mm">
<param name="initial_mode" value="Browse">
<param name="selection_method" value="selection_method_direct">
<p style="text-align:center;font-weight:bold;text-decoration:underline;">
FreeMind Browser Java Applet. You have to install Java Plug-in in order to see it.
</p>
</applet>
For including an Applet into a Google Sites page you can use Embed Gadget (Insert -> More Gadgets -> Featured -> Embed Gadget) and paste the above snippet into.
As I mentioned above it is possible to deploy FreeMind Browser Applet using Java Web Start. This can give you a speed boost in case you are experiencing problems with Applets. Doing this is very easy and requires only the configuration of one XML file with JNLP (Java Network Launching Protocol) extension. Below you can see how test-mm-freemind.jnlp file looks like:
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="https://sites.google.com/site/azagorneanu/mm/test/"
href="test-mm-freemind.jnlp">
<information>
<title>Test FreeMind MindMap</title>
<vendor>FreeMind & Andrei Zagorneanu</vendor>
<description>Test MindMap by Andrei Zagorneanu</description>
<description kind="short">
Test FreeMind MindMap [http://freemind.sourceforge.net/]
prepared by Andrei Zagorneanu [http://azagorneanu.blogspot.com/]
</description>
<homepage href="http://azagorneanu.blogspot.com/"/>
<icon href="https://sites.google.com/site/azagorneanu/freemind/freemind-icon.png"
width="128" height="128"/>
</information>
<resources>
<j2se version="1.4+" />
<jar href="https://sites.google.com/site/azagorneanu/freemind/freemind-browser.jar" />
<jar href="https://sites.google.com/site/azagorneanu/mm/test/test-mm-freemind.jar" />
</resources>
<applet-desc name="FreeMind Browser" width="1200" height="700"
main-class="freemind.main.FreeMindApplet">
<param name="type" value="application/x-java-applet;version=1.4" />
<param name="scriptable" value="false" />
<param name="modes" value="freemind.modes.browsemode.BrowseMode" />
<param name="browsemode_initial_map"
value="jar:https://sites.google.com/site/azagorneanu/mm/test/test-mm-freemind.jar!/test.mm" />
<param name="initial_mode" value="Browse" />
<param name="selection_method" value="selection_method_direct" />
</applet-desc>
</jnlp>
Next, this file has to be uploaded along with other jar files and then used inside a link (anchor) as follows:
<a href="/site/azagorneanu/mm/test/test-mm-freemind.jnlp">Browse using Java Web Start</a>
After clicking on link, choose Open option or save the file to your computer and then open it. The FreeMind browser should start.
Here https://sites.google.com/site/azagorneanu/mm/test you can find deployed both versions (Applet and Java Web Start) of our Test mind map (FreeMind version 0.9.0).
Make sure that you have installed Java Plug-in for your browser. In case your browser is 32-bit (x86) you have to install a version of Java also for 32-bit. For example for Firefox 4 you have to install a 32-bit version of Java. For a 64-bit browser you will need a 64-bit java. More information can be found here: Which Java download should I choose for my 64-bit Windows operating system? You can download latest java from http://java.com/.
Update (28-Nov-2012): FreeMind mind maps exported as Java Applet have a very powerful feature: Find facility. Unfortunately you can use Copy/Paste only inside your applet or between applets. Copy/Paste from the system clipboard was deemed a security hole and disabled (starting with release of the Java Plug-in 1.6.0_24 in February 2011). You can find more information and instructions about how to enable access to the system clipboard again here: Copy And Paste in Java Applets
Man, I love you for your advice how to solve problem with "not showing" the pictures.. Thank you very much!
ReplyDeleteYou are welcome!
DeleteBonjour, thanks for the informations.
ReplyDeleteI try to embed a flash mind map, do u know how i can do it ?
Thanks for advance
merci d'avance
Unfortunately I didn't try that. Mind-maps exported as Flash look differently (more ugly, formatting is not fully supported) than ones exported as Java.
DeleteI can see that in both of your maps Search feature (Ctrl+F) works but on my maps it doesn't. I even tried the default freemind.mm file and it still doesn't work. Any ideas what I'm missing?
ReplyDeleteYou can check the Java console for errors if any.
DeleteYes, there are errors in Java console:
DeleteException in thread "AWT-EventQueue-2" java.lang.IllegalArgumentException: The applet has no frames
at freemind.main.FreeMindApplet.getJFrame(FreeMindApplet.java:381)
at freemind.modes.common.actions.FindAction.displayDialog(FindAction.java:144)
at freemind.modes.common.actions.FindAction.actionPerformed(FindAction.java:103)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$400(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
It seems that you are using a wrong version of FreeMind applet. You have to use freemindbrowser.jar that comes with FreeMind distribution. Use version 0.9.0 which is the latest stable version of FreeMind at this moment. Test Mind Map applet deployed by me is using FreeMind version 0.9.0
DeleteHi,
ReplyDeleteGood evening, well in Paris France, at this time it is pretty dark.
I have tried for the last 2 weeks to make your protocol work for me as I want to integrate some of my many freemind maps in my blog. Fortunately there are no images.
I have to admit I could not do it probably because I could not understand the following:
1 param name="browsemode_initial_map" value="./freemind.mm"
Where do put this 'sentence'?
1 jar –cvf test-mm-freemind.jar *
How and where do you do that?
I did it in the old DOS enviroment but, as anticipated, it failled
Then I suspect the file have to be stored in a place that is not Google drive which is accessible only in read mode, at least for me.
I hope you will be able to help me with this.
Kind regards.
Marc.
Hi Marc,
DeleteIn Cyprus at this time is pretty dark as well ;)
So, let's try to do it together:
* Create a new empty folder, let's name it mymapdir
* Create a new mind map and save it inside the newly created folder that was mentioned above. Let's name the mind map file as mymap.mm
* Also inside mymapdir folder create a new empty folder, let's name it images. Copy all the images that you plan to use inside your mind map into this folder. Build your mind map using the images from the newly created images folder. This will ensure that all the paths to images are relative (e.g. images/image1.png)
* In order to package the mind map as a jar file we will use the jar utility which is part of Java Development Toolkit (JDK). If you don't have the JDK installed then you will have to do it. It can be downloaded from here http://www.oracle.com/technetwork/java/javase/downloads/index.html
* Package your mind map file mymap.mm together with all the images as one jar file. In order to do this, run the following command inside mymapdir folder:
jar –cvf mymap.jar *
* Upload the newly created mymap.jar file to a location where it can be accessed through HTTP (some file hosting). Don't use Google Drive, Dropbox, etc. You need a simple file hosting. You can use Google Sites for this, as I did in the blog post.
* Upload also freemind-browser.jar file to same location. You can find it inside the freemind distribution.
* If you want to embedd your mind map as an applet then use the applet code snippet from above blog post. Just add it to your HTML page. Make sure to change all the locations of *.jar files to yours.
* If you want to use Java Web Start then you have to create a new file, let's name it mymap.jnlp using the code snippet from blog post. Also make sure to change all the locations of *.jar files to yours. Upload the newly created mymap.jnlp file to some web location and link it inside your HTML page using the anchor (<a>) HTML element as it was shown in blog post.
Hopefully this will help you.
Hi all,
ReplyDeleteI've recently downloaded Freemind and trying to export as a java applet and having issues. I've tried the "title" fix that Andrei mentioned above. However, I'm getting a "Null Pointer Exception" error when it tries to run. I'm using Chrome on Win 7. Have also tried on IE explorer and on a Windows 8 machine and still getting the same error. Any help would be appreciated!
Hi,
DeleteWhat version of Freemind are you using? The version used in this post is 0.9.0, which is the latest stable version of Freemind.
Please be aware that it may not be compatible with newest 1.0.0-RC (Release Candidate).
Hi Andrei,
DeleteI'm using version 0.9.0.
Thanks.
Do you have still troubles with it? You can check the Java console for errors if any.
DeleteYes, still having issues. Below is copied from the Java console for errors. I don't profess to be an expert in Java, so this doesn't mean much to me.
DeleteJava Plug-in 10.25.2.17
Using JRE version 1.7.0_25-b17 Java HotSpot(TM) Client VM
User home directory = C:\Users\boc
----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to
----------------------------------------------------
Could not load properties.
Error while setting Look&Feel
I have tried now and I'm getting the same error. I suppose this is caused by all the critical security fixes related to Java Applets which were done in Java 7.
DeleteAs an alternative you can deploy your applets using Java Web Start, I checked it now and it is working. I described how to do it in this post also.
You may ask as well on FreeMind Help Forum about this issue. Maybe it will be fixed in the upcoming version of FreeMind (1.0.0).
Unfortunately I cannot help you more with this issue. I'm not a FreeMind active user anymore.
Thanks Andrei. I appreciate your help.
Delete