Solved Batchscript does not run correctly

November 28, 2013 at 02:20:25
Specs: Windows 7, 2048
Hi everyone,

I'm currently trying to get the bonnmotion program to work under Win 7 64bit. Currently I'm facing the problem that my batchfile seems to be not suitable for the OS I'm using.

Batchfile
@echo off

REM *********************************************
REM Please configure for your enviroment

set JAVAPATH=C:\Programme (x86)\Java\jre7
set BONNMOTION=D:\Bachelorarbeit\bonnmotion-2.1

REM *********************************************

echo BonnMotion - mobility scenario generation and analysis tool
echo Copyright (C) 2002-2011 University of Bonn
echo.
echo This program is free software; you can redistribute it and/or modify
echo it under the terms of the GNU General Public License as published by
echo the Free Software Foundation; either version 2 of the License, or
echo (at your option) any later version."
echo.
echo This program is distributed in the hope that it will be useful,
echo but WITHOUT ANY WARRANTY; without even the implied warranty of
echo MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
echo GNU General Public License for more details.
echo.
echo You should have received a copy of the GNU General Public License
echo along with this program; if not, write to the Free Software
echo Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
echo.
echo.

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;%BONNMOTION%\lib\javaproj-1.0.4.jar;%BONNMOTION%\lib\proj4j-0.1.0.jar;%BONNMOTION%\lib\proj4j-support-0.1.0.jar %PACKAGE%.run.BM %%* >> bin\%FILE%
echo cd bin >> 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;lib\javaproj-1.0.4.jar;lib\proj4j-0.1.0.jar;lib\proj4j-support-0.1.0.jar %%%%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.
echo Starting compilation ...
call bin\compile.bat
@echo off
echo compilation done ...
echo.
echo \bin\bm.bat -h
call bin\bm.bat

:Ende


CMD output

D:\Bachelorarbeit\bonnmotion-2.1>install
BonnMotion - mobility scenario generation and analysis tool
Copyright (C) 2002-2011 University of Bonn

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version."

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA


"\Java\jre7\bin\java.exe" kann syntaktisch an dieser Stelle nicht verarbeitet w
erden.

I know the error is in german, but there seems to be a problem with the syntax in the batchfile, does anyone has a clue how its fixable?

My thanks in advance

greets
Sasuchi


See More: Batchscript does not run correctly

Report •


#1
November 28, 2013 at 21:50:25
Since your install never got to "installing", I would hazard a guess it might be the parentheses in: set JAVAPATH=C:\Programme (x86)\Java\jre7
because it containes parentheses. Try putting dbl-quotes around this path:
set JAVAPATH="C:\Programme (x86)\Java\jre7"
Batch tends to vomit when fed parentheses. Also, (debug-101), put echos and pauses to see how far the script(s) gets before bombing. You need to know which script is failing, and what operation (line no.) is failing. Batch won't tell you these things, you have to sleuth it out.

message edited by nbrane


Report •

#2
December 2, 2013 at 01:05:43
D:\Bachelorarbeit\bonnmotion-2.1>REM *******************************************
**

D:\Bachelorarbeit\bonnmotion-2.1>REM Please configure for your enviroment

D:\Bachelorarbeit\bonnmotion-2.1>set JAVAPATH="C:\Programme (x86)\Java\jre7"

D:\Bachelorarbeit\bonnmotion-2.1>set BONNMOTION=D:\Bachelorarbeit\bonnmotion-2.1


D:\Bachelorarbeit\bonnmotion-2.1>REM *******************************************
**

D:\Bachelorarbeit\bonnmotion-2.1>echo BonnMotion - mobility scenario generation
and analysis tool
BonnMotion - mobility scenario generation and analysis tool

D:\Bachelorarbeit\bonnmotion-2.1>echo Copyright (C) 2002-2011 University of Bonn

Copyright (C) 2002-2011 University of Bonn

D:\Bachelorarbeit\bonnmotion-2.1>echo.


D:\Bachelorarbeit\bonnmotion-2.1>echo This program is free software; you can red
istribute it and/or modify
This program is free software; you can redistribute it and/or modify

D:\Bachelorarbeit\bonnmotion-2.1>echo it under the terms of the GNU General Publ
ic License as published by
it under the terms of the GNU General Public License as published by

D:\Bachelorarbeit\bonnmotion-2.1>echo the Free Software Foundation; either versi
on 2 of the License, or
the Free Software Foundation; either version 2 of the License, or

D:\Bachelorarbeit\bonnmotion-2.1>echo (at your option) any later version."
(at your option) any later version."

D:\Bachelorarbeit\bonnmotion-2.1>echo.


D:\Bachelorarbeit\bonnmotion-2.1>echo This program is distributed in the hope th
at it will be useful,
This program is distributed in the hope that it will be useful,

D:\Bachelorarbeit\bonnmotion-2.1>echo but WITHOUT ANY WARRANTY; without even the
implied warranty of
but WITHOUT ANY WARRANTY; without even the implied warranty of

D:\Bachelorarbeit\bonnmotion-2.1>echo MERCHANTABILITY or FITNESS FOR A PARTICULA
R PURPOSE. See the
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

D:\Bachelorarbeit\bonnmotion-2.1>echo GNU General Public License for more detail
s.
GNU General Public License for more details.

D:\Bachelorarbeit\bonnmotion-2.1>echo.


D:\Bachelorarbeit\bonnmotion-2.1>echo You should have received a copy of the GNU
General Public License
You should have received a copy of the GNU General Public License

D:\Bachelorarbeit\bonnmotion-2.1>echo along with this program; if not, write to
the Free Software
along with this program; if not, write to the Free Software

D:\Bachelorarbeit\bonnmotion-2.1>echo Foundation, Inc., 59 Temple Place, Suite 3
30, Boston, MA 02111-1307 USA
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

D:\Bachelorarbeit\bonnmotion-2.1>echo.


D:\Bachelorarbeit\bonnmotion-2.1>echo.


D:\Bachelorarbeit\bonnmotion-2.1>set PACKAGE=edu.bonn.cs.iv.bonnmotion

D:\Bachelorarbeit\bonnmotion-2.1>set JAVA="C:\Programme (x86)\Java\jre7"\bin\jav
a.exe

D:\Bachelorarbeit\bonnmotion-2.1>set JAVAC="C:\Programme (x86)\Java\jre7"\bin\ja
vac.exe

D:\Bachelorarbeit\bonnmotion-2.1>set JAVADOC="C:\Programme (x86)\Java\jre7"\bin\
javadoc.exe

D:\Bachelorarbeit\bonnmotion-2.1>if not exist "C:\Programme (x86)\Java\jre7"\bin
\java.exe (
echo Don't forget to configure this script.
echo Could not find java.exe : "C:\Programme (x86)\Java\jre7"\bin\java.exe
goto Ende
)
Don't forget to configure this script.
Could not find java.exe : "C:\Programme (x86)\Java\jre7"\bin\java.exe

D:\Bachelorarbeit\bonnmotion-2.1>

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

Im thinking that somehow the space of the program folder is a problem

message edited by sasuchi


Report •

#3
December 5, 2013 at 06:55:31
✔ Best Answer
Though it is hard to muddle through the script with the not as englishy script. it looks as though the batch is doing what it is supposed to. it looks like it fails on the following.

D:\Bachelorarbeit\bonnmotion-2.1>if not exist "C:\Programme (x86)\Java\jre7"\bin\java.exe

try navigating to that directory and see if it is there. my guess is that there is an issue with that directory not the batch.

or try
"C:\Programme (x86)\Java\jre7\bin\java.exe"
::mike

message edited by mikelinus


Report •
Related Solutions


Ask Question