Re: [greenstone-users] not able to execute setup.bat

From John M Thompson
DateThu, 18 Dec 2003 14:49:28 +1300
Subject Re: [greenstone-users] not able to execute setup.bat
In-Reply-To (Pine-LNX-4-53-0312171242340-22334-ncsi-iisc-ernet-in)
Hello Nirupama and Francis,

It sounds like Greenstone/GLI is getting stuck on the same line in both
of your cases. In order to get enough environment memory to run
Greenstone/GLI (nothing to do with RAM) we make a program call under
Win98 which looks a little like this (the letter case isn't important,
and there may be several other arguments):

COMMAND /E:2048

I would imagine that this line is somehow causing the "Bad command or
filename" message, and then, since it hasn't been run, Greenstone
subsequently runs out of memory (the /E:2048 argument sets environment
memory to 2MB). Of course why this is happening I'm not so sure about.

The first thing I would suggest is attempting to open a old style DOS
prompt. To do this go to Start Menu->Run, and in the textbox type:

command

and press enter. If this doesn't work then you're likely using the newer
DOS prompt, which is started by typing cmd instead, and doesn't suffer
from the same lack of environment memory problem. If it does work then
the next thing to try is typing in the problematic line above. If it
doesn't work, or displays an error message, then you have a strange
version of command.com and we'll try to provide you with a working one.

Now if you have a newer DOS prompt, or if the problem command seems to
work fine, then we have to edit the setup.bat or gli.bat. The thing to
try would be to find the line noted above and change it so it is:

COMMAND.COM /E:2048 <other arguments unchanged>

Some versions of Win98 require the file extension ".com" to be added.

If that doesn't help, or if your systems using cmd anyway, try using the
appropriate attached batch file. Rename the old file (setup.bat or
gli.bat) first, and then copy the appropriate file into its place.
Finally rename these files by removing the .txt (an unfortunate
necessity of sending executable files from the university). In
these versions of the batch files I've commented out the offending
lines. There is a good chance that this won't actually help, and you'll
still suffer from an "Out of Memory" error, but its worth a shot.

Good Luck, Cheers, and Merry Christmas

John Thompson
Greenstone Project, NZDL, University of Waikato,
New Zealand

Francis Jayakanth wrote:

>Hello List:
>
>I have successfully installed local library version of GSDL 2.41 on a PIII
>system running Windows 98 OS with 256 MB of RAM. I'm able to build a
>collection using the 'collector'. However, I'm unable to build the
>collection in the command prompt. When I change directory (cd) to the GSDL
>installation directory and execute the command, 'setup.bat', a series of
>same error message, "Bad command or file name" is displayed. The error
>message "Program is too big to fit in memory" is also displayed. Could you
>please let me what am I doing wrong. There is no such problem on a system
>running Windows 2000 Professional OS.
>
>Many thanks,
>
> - Francis
>
>NCSI, IISc
>Bangalore, India
>
>
>_______________________________________________
>greenstone-users mailing list
>greenstone-users@list.scms.waikato.ac.nz
>https://list.scms.waikato.ac.nz/mailman/listinfo/greenstone-users
>
>
and Nirupama Bawdekar wrote:

>hi,
>
>I am using windows 98.
>
>reg,
>nirupama bawdekar
>
>On Mon, 15 Dec 2003, John M Thompson wrote:
>
>
>
>>Hello Nirupama Bawdekar,
>>
>>What version of windows are you running (XP, NT, 2000, 98, 95 etc)?
>>
>>John Thompson
>>Greenstone Digital Libraries, University of Waikato
>>New Zealand
>>
>>Nirupama Bawdekar wrote:
>>
>>
>>
>>>Hi,
>>>
>>>I have downloaded the 2.41 windows version, and installed it
>>>on a p4 machine. However when i try to access GLI, it gives the following
>>>error on accessing the program files>greenstone>GLI option:
>>>
>>>Bad command or file name
>>>Program too big to fit in memory
>>>
>>>can you help?
>>>
>>>reg,
>>>
>>>Mrs Nirupama Bawdekar
>>>


<<attachment>>
Type: text/plain
Filename: gli.bat.txt

@echo off

echo
echo Greenstone Librarian Interface (GLI)
echo Copyright (C) 2003 Greenstone Digital Libraries, University Of Waikato
echo GLI comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt
echo This is free software, and you are welcome to redistribute it
echo


:: -------- Run the Greenstone Librarian Interface --------

:: This script must be run from within the directory in which it lives
if exist gli.bat goto start
echo This script must be run from the directory in which it resides.
goto exit

:start
REM if "%OS%" == "Windows_NT" goto findGSDL
:: Invoke a new command processor to ensure there's enough environment space
REM if "%1" == "Second" goto findGSDL
REM command /E:2048 /C %0 Second %1 %2 %3 %4 %5 %6 %7 %8 %9
REM goto done


:findGSDL
:: ---- Determine GSDLHOME ----
set GSDLPATH=

:: Some users may set the above line manually
if not "%GSDLPATH%" == "" goto testGSDL

:: The default location for the GLI is a subdirectory of Greenstone
set GSDLPATH=..

:: If it is set, use the GSDLHOME environment variable
if "%GSDLHOME%" == "" goto testGSDL
set GSDLPATH=%GSDLHOME%

:testGSDL
:: Check that the Greenstone installation looks OK
echo Checking GSDL: %GSDLPATH%
if exist "%GSDLPATH%setup.bat" goto prepGSDL
echo.
echo The Greenstone installation could not be found, or is incomplete.
echo Try reinstalling Greenstone then running this script again.
goto exit

:prepGSDL
:: Setup Greenstone, unless it has already been done
if not "%GSDLHOME%" == "" goto doneGSDL
call "%GSDLPATH%setup.bat" SetEnv > nul

:doneGSDL
:: GSDLPATH is no longer needed, since GSDLHOME should now be set
set GSDLPATH=


:findPerl
:: ---- Check Perl exists ----
set PERLPATH=

:: Some users may set the above line manually
if not "%PERLPATH%" == "" goto testPerl

:: Check if Perl is on the search path
echo %PATH%| winutilwhich.exe perl.exe | winutilsetvar.exe PERLPATH > setperl.bat
call setperl.bat
del setperl.bat
if not "%PERLPATH%" == "" goto testPerl

:: If not, try GSDLHOMEbinwindowsperlbin
if exist "%GSDLHOME%binwindowsperlbinperl.exe" goto gsdlPerl

:: Still haven't found anything, so try looking in the registry (gulp!)
type nul > perl.reg
regedit /E perl.reg "HKEY_LOCAL_MACHINESOFTWAREPerl"
type perl.reg > perl.txt
del perl.reg

winutilfindperl.exe perl.txt | winutilsetvar.exe PERLPATH > setperl.bat
del perl.txt
call setperl.bat
del setperl.bat

:: If nothing was found in the registry, we're stuck
if "%PERLPATH%" == "" goto noPerl

goto testPerl

:gsdlPerl
set PERLPATH=%GSDLHOME%binwindowsperlbin

:testPerl
:: Check that a Perl executable has been found
echo Checking Perl: %PERLPATH%
if exist "%PERLPATH%perl.exe" goto findJava

:noPerl
echo.
echo The Greenstone Librarian Interface requires perl in order to operate,
echo but perl could not be detected on your system. Please ensure that perl
echo is installed and is on your search path, then rerun this script.
goto exit


:findJava
:: ---- Check Java exists ----
set JAVAPATH=

:: Some users may set the above line manually
if not "%JAVAPATH%" == "" goto testJava

:: If it is set, use the JAVAHOME environment variable
if not "%JAVAHOME%" == "" goto javahome

:: Check if Java is on the search path
echo %PATH%| winutilwhich.exe java.exe | winutilsetvar.exe JAVAPATH > setjava.bat
call setjava.bat
del setjava.bat
if not "%JAVAPATH%" == "" goto testJava

:: Still haven't found anything, so try looking in the registry (gulp!)
type nul > jdk.reg
regedit /E jdk.reg "HKEY_LOCAL_MACHINESOFTWAREJavaSoftJava Development Kit"
type jdk.reg > jdk.txt
del jdk.reg
type nul > jre.reg
regedit /E jre.reg "HKEY_LOCAL_MACHINESOFTWAREJavaSoftJava Runtime Environment"
type jre.reg > jre.txt
del jre.reg

winutilfindjava.exe jdk.txt jre.txt | winutilsetvar.exe JAVAPATH > setjava.bat
del jdk.txt
del jre.txt
call setjava.bat
del setjava.bat

:: If nothing was found in the registry, we're stuck
if "%JAVAPATH%" == "" goto noJava

set JAVAPATH=%JAVAPATH%bin
goto testJava

:javahome
set JAVAPATH=%JAVAHOME%bin

:testJava
:: Check that a Java executable has been found
echo Checking Java: %JAVAPATH%
if exist "%JAVAPATH%java.exe" goto checkGLI

:noJava
echo.
echo Failed to locate an appropriate version of Java. You must install a
echo Java Runtime Environment (version 1.4 or greater) before running the
echo Greenstone Librarian Interface.
goto exit


:checkGLI
:: ---- Check that the GLI has been compiled ----
if exist "classes/org/greenstone/gatherer/Gatherer.class" goto runGLI
if exist "GLI.jar" goto runGLI
echo.
echo You need to compile the Greenstone Librarian Interface (using makegli.bat)
echo before running this script.
goto exit


:runGLI
:: ---- Finally, run the GLI ----
echo.
echo Running the Greenstone Librarian Interface...

:: -Xms32M To set minimum memory
:: -Xmx32M To set maximum memory
:: -verbose:gc To set garbage collection messages
:: -Xincgc For incremental garbage collection
:: -Xprof Function call profiling
:: -Xloggc:<file> Write garbage collection log

if exist "%GSDLHOME%server.exe" goto localLib
"%JAVAPATH%java" -cp classes/;GLI.jar;lib/apache.jar;lib/calpa.jar;lib/jp.jar;lib/polloxml.jar;lib/qfslib.jar;lib/skinlf.jar;lib/nanoxml.jar org.greenstone.gatherer.Gatherer -gsdl %GSDLHOME% -perl %PERLPATH% %1 %2 %3 %4 %5 %6 %7 %8 %9

echo Done!
goto done

:localLib
"%JAVAPATH%java" -cp classes/;GLI.jar;lib/apache.jar;lib/calpa.jar;lib/jp.jar;lib/polloxml.jar;lib/qfslib.jar;lib/skinlf.jar;lib/nanoxml.jar org.greenstone.gatherer.Gatherer -gsdl %GSDLHOME% -perl %PERLPATH% -library %GSDLHOME%server.exe %1 %2 %3 %4 %5 %6 %7 %8 %9

echo Done!
goto done

:exit
echo.
pause

:done
:: ---- Clean up ----
set PERLPATH=
set JAVAPATH=


<<attachment>>
Type: text/plain
Filename: setup.bat.txt

@echo off
if "%OS%" == "Windows_NT" goto WinNT
if "%OS%" == "" goto Win95Env
echo Setup failed - your PATH has not been set
goto End

:WinNT
set GSDLHOME=**GSDLHOME**
set GSDLOS=windows
set PATH=%GSDLHOME%binwindowsperlbin;%GSDLHOME%binwindows;%GSDLHOME%binscript;%PATH%
goto Success

:Win95
if "%1" == "SetEnv" goto Win95Env
REM We'll invoke a second copy of the command processor to make
REM sure there's enough environment space
COMMAND /E:2048 /K %0 SetEnv
goto End

:Win95Env
set GSDLHOME=**GSDLHOME**
set GSDLOS=windows
set PATH="%GSDLHOME%binwindowsperlbin";"%GSDLHOME%binwindows";"%GSDLHOME%binscript";"%PATH%"

:Success
echo Your environment has successfully been set up to run Greenstone.
echo Note that these settings will only have effect within this MS-DOS
echo session. You will therefore need to rerun setup.bat if you want
echo to run Greenstone programs from a different MS-DOS session.

:End