Friday, January 16, 2009

How I installed bonnmotion on WindowsXP system with jdk1.5

My project needs a Random way point scenario to be created, and on searching on Google i came across a useful tool called as Bonnmotion. The tool seemed to be useful but the problem is that it is a very old version. This tool can be downloaded from this link and you can find the documentation of this tool here. This is the homepage of this tool BonnMotion.

http://web.informatik.uni-bonn.de/IV/Mitarbeiter/dewaal/BonnMotion/

The BonnMotion is a Java software. It can be installed in Linux and also in Windows. It has been tested on jdk1.4. It can be used to create the following models
  • the Random Waypoint model,
  • the Gauss-Markov model,
  • the Manhattan Grid model and
  • the Reference Point Group Mobility model.
Coming to my experience, recently my whole day was wasted installing this tool. I initially tried to install it on Linux but as I need to install java in Linux and my Linux version is RHEL 3, which is a old version (I was concerned whether jdk6 will be compatible with RHEL 3 or not) so I decided I would go with Windows instead. The sad part of the story is that I was unable to install it straight-away in Windows either.

Once I tried to execute the install script it asked the java path which I provided, my Java path is
C:\Program Files\Java\jdk1.5.0
and next it asked the bonnmotion path. I placed my bonnmotion in the C: directory itself.

I initially thought the problem was concerning with version compatability of Java, Bonnmotion was tested with jdk1.4, and I have jdk1.5 installed on my system. I searched in the net for jdk1.4 and was unsuccessful in my effort, than I tested some of the scripts in batch file and felt like there were some problems with the scripts in batch files.[This I cannot guarantee, and is just my thought].

Ok this is what I did and successfully installed Bonnmotion in my Windows XP.
While looking at the errors
"The system cannot find the specified path"
I observed that the error emerged from the statements
if not exists ......
script statement in "install.bat" batch script
so I removed all such statements from that script, and also embeded the important JAVA variables within double quotes

Here are the steps to be followed:
1. Try to edit the install.bat file using notepad or any of your favourite text editor,

2. This is the install.bat file before modification(here I am showing only the lines to be modified, not the entire code)

.............................
.............................

set PACKAGE=edu.bonn.cs.iv.bonnmotion
set JAVA=%JAVAPATH%\bin\java.exe
set JAVAC=%JAVAPATH%\bin\javac.exe
set JAVADOC=%JAVAPATH%\bin\javadoc.exe

if not exist %JAVA% (
echo Don't forget to configure this script.
echo Could not find java.exe : %JAVA%
goto Ende
)
if not exist %JAVAC% (
echo Don't forget to configure this script.
echo Could not find javac.exe : %JAVAC%
goto Ende
)
if not exist %JAVADOC% (
echo Don't forget to configure this script.
echo Could not find javadoc.exe : %JAVACDOC%
goto Ende
)
if not exist %BONNMOTION% (
echo Don't forget to configure this script.
echo Could not find BonnMotion root directory: %BONNMOTION%
goto Ende
)

echo Installing ...

REM bm
set FILE=bm.bat
echo %FILE%
if exist bin\%FILE% del bin\%FILE%
echo @echo off >> bin\%FILE%
echo cd %BONNMOTION% >> bin\%FILE%
echo %JAVA% -cp %BONNMOTION%\classes %PACKAGE%.run.BM %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9 >> bin\%FILE%

REM compile
set FILE=compile.bat
echo %FILE%
if exist bin\%FILE% del bin\%FILE%
echo @echo off >> bin\%FILE%
echo cd %BONNMOTION% >> bin\%FILE%
echo if not exist classes mkdir classes >> bin\%FILE%
echo echo on >> bin\%FILE%
echo for /r %%%%i in (*.java) do %JAVAC% -d classes -sourcepath src -classpath classes %%%%i >> bin\%FILE%

REM makedoc
set FILE=makedoc.bat
echo %FILE%
if exist bin\%FILE% del bin\%FILE%
echo @echo off >> bin\%FILE%
echo cd %BONNMOTION% >> bin\%FILE%
echo if not exist doc mkdir doc >> bin\%FILE%
echo %JAVADOC% -quiet -d doc -use -windowtitle "BonnMotion" -sourcepath %BONNMOTION%\src edu.bonn.cs.iv.bonnmotion edu.bonn.cs.iv.bonnmotion.apps edu.bonn.cs.iv.bonnmotion.run edu.bonn.cs.iv.bonnmotion.models >> bin\%FILE%

echo done.
:Ende


......................................
......................................

3. After deleting the conditional statements which start with "if not exist" (You can also comment the lines if you do not want to delete them, by placing :: before the lines) and embeding some important Java variables (JAVA,JAVAC,JAVADOC) within doublequotes

The modified code looks like this

..............................
..............................

set PACKAGE=edu.bonn.cs.iv.bonnmotion
set JAVA=%JAVAPATH%\bin\java.exe
set JAVAC=%JAVAPATH%\bin\javac.exe
set JAVADOC=%JAVAPATH%\bin\javadoc.exe

::The conditional statements are deleted

echo Installing ...

REM bm
set FILE=bm.bat
echo %FILE%
if exist bin\%FILE% del bin\%FILE%
echo @echo off >> bin\%FILE%
echo cd %BONNMOTION% >> bin\%FILE%
echo "%JAVA%" -cp %BONNMOTION%\classes %PACKAGE%.run.BM %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9 >> bin\%FILE%

REM compile
set FILE=compile.bat
echo %FILE%
if exist bin\%FILE% del bin\%FILE%
echo @echo off >> bin\%FILE%
echo cd %BONNMOTION% >> bin\%FILE%
echo if not exist classes mkdir classes >> bin\%FILE%
echo echo on >> bin\%FILE%
echo for /r %%%%i in (*.java) do "%JAVAC%" -d classes -sourcepath src -classpath classes %%%%i >> bin\%FILE%

REM makedoc
set FILE=makedoc.bat
echo %FILE%
if exist bin\%FILE% del bin\%FILE%
echo @echo off >> bin\%FILE%
echo cd %BONNMOTION% >> bin\%FILE%
echo if not exist doc mkdir doc >> bin\%FILE%
echo "%JAVADOC%" -quiet -d doc -use -windowtitle "BonnMotion" -sourcepath %BONNMOTION%\src edu.bonn.cs.iv.bonnmotion edu.bonn.cs.iv.bonnmotion.apps edu.bonn.cs.iv.bonnmotion.run edu.bonn.cs.iv.bonnmotion.models >> bin\%FILE%

echo done.
:Ende

......................................
......................................

4. Now try to install the Bonnmotion by double clicking the install.bat file. If you see these files being created
bm.bat
compile.bat
makedoc.bat
than bonnmotion is successfully installed in your system. Congrats!!!

Any Comments, Suggestions, Positive Criticism and Corrections are welcome!!!

Hope it helped!
Good Luck!!! :)

11 comments:

Anonymous said...

Hi,
I downloaded bonnmotion and stuck to this problem of installation in windows xp.

But thanks to your modifications, managed to install it.
Would never come to this solution myself, by the wasy. :)

Anonymous said...

Please can you tell me how can I install bonnmotion on linux

sanjoy said...

Thank you very much for your great help

Anonymous said...

Hi,
Many thanks.It really help me.Work fine like rocket

namrata jagtap said...

HEY REALLY THANXXXXXXX
I WASTE MY 2 DAYS IN INSTALLATION...NOW I CAN TRY MOBILITY MODELS

sakthi said...

thank you...it works well for jdk1.7 also
if it is not working means add quotes in
REM compile
set FILE=compile.bat
echo %FILE%
if exist bin\%FILE% del bin\%FILE%
echo @echo off >> bin\%FILE%
echo cd %BONNMOTION% >> bin\%FILE%
echo if not exist classes mkdir classes >> bin\%FILE%
echo echo on >> bin\%FILE%
echo for /r %%%%i in (*.java) do "%JAVAC%" -d classes -sourcepath src -classpath classes;lib\javaproj-1.0.4.jar "%%%%i" >> bin\%FILE%

sakthi said...

thank you...it works well for jdk1.7 also
if it is not working means add quotes in
REM compile
set FILE=compile.bat
echo %FILE%
if exist bin\%FILE% del bin\%FILE%
echo @echo off >> bin\%FILE%
echo cd %BONNMOTION% >> bin\%FILE%
echo if not exist classes mkdir classes >> bin\%FILE%
echo echo on >> bin\%FILE%
echo for /r %%%%i in (*.java) do "%JAVAC%" -d classes -sourcepath src -classpath classes;lib\javaproj-1.0.4.jar


HERE ADD QUOTES
"%%%%i" >> bin\%FILE%

Saurabh Chaudhary said...

Thanks for installation of bonnmotion ....
But after installation i can't run bm command and scenario is not generate.
please kindly help in this regard.
Thank u in advance.

Jaspreet Singh said...

Can someone pls tell me what should be the value of variable BONNMOTION in install.bat. Could not figure out & therefore installation not working

turfsniffer said...

Thank you so much for this!!

Arvind Shukla said...

kindly help me for this
bm -f example TIMM -b graph -F 1.037,0.212 -g 4,4,4,4 -G -o 16.1,66.8 -s 0.577,0.106 -S 10,20,30,40 -n 16


Tactical Indoor Mobility Model ("TIMM").
i am facing problem to run this command
when i put this cmd as its is at cmd prompt
The problem is :
error whil parshing string to double array:"1.037 0.212"
java.lang.NumberFormatException:For input string:"1.037 0.212"

kindly help me for running this command

Regards
Arvind Shukla