AMAPstudio

User Tools


Tell capsis.bat and ant.bat to use a version of Java which is not in the PATH

Sometimes, it is not possible to put a specific version of Java in the system path. It is still possible to use Capsis (compile and run it) without changing any environment variable. This example is for Windows, it can be adapted for Mac and Linux.

The two scripts to be modified ant.bat and capsis.bat are both located in the capsis4/ installation directory.

Open ant.bat in an editor and adapt it this way (see at the begining, 'PATH=…'):

@echo off

rem fc-10.2.2014
rem On this machine, ant uses jdk1.6.0 even if java 1.7 is in the system path 
PATH=C:\Program Files\Java\jdk1.6.0_45\bin;%PATH%

REM fc - 3.3.2009 - rely on jdk in the path (trouble when JAVA_HOME contains a jre home)

set JAVA_HOME=""
set spath=%~dp0

cd %spath%
ext/ant/bin/ant.bat %*

Open capsis.bat in a editor and adapt it this way (see at the begining, 'PATH=…'):

@echo off

rem fc-10.2.2014
rem On this machine, Capsis uses jdk1.6.0 even if java 1.7 is in the system path 
PATH=C:\Program Files\Java\jdk1.6.0_45\bin;%PATH%
rem PATH=C:\Program Files (x86)\Java\jdk1.6.0_45\bin;%PATH%

set OLDDIR=%CD%

rem go to the capsis root directory
cd /d %0\..
set CURRENTDIR=%CD%


rem Check wether the splashscreen should be displayed (yes, except in script mode)
set splashoption=-splash:etc/splash.png
set string0=%* notempty
set string1=%string0:script=%

rem echo.string0:%string0%
rem echo.string1:%string1%

IF NOT "%string0%" == "%string1%" (
  echo.Script: splashscreen was desactivated
  set splashoption=
)



rem Check architecture, set default memory and dll path
if "%PROCESSOR_ARCHITECTURE%"=="x86" (

  set msg-archi=32 bits architecture
  set mem=1024
  set CAPSISEXT=%CURRENTDIR%\ext\windows
   
) else  (

  set msg-archi=64 bits architecture
  set mem=6144
  set CAPSISEXT=%CURRENTDIR%\ext\windows64

) 

PATH=%CAPSISEXT%;%PATH%


rem Chek if 'memory' file exists, read it (1 single line, e.g. 4096)
if exist memory (
  for /f "tokens=*" %%a in (memory) do (
    set mem=%%a
  )
)


rem Setting max memory, adding 'm' for 'Mega bytes'
set memo="%mem%m"
set msg-memory=max memory: %mem% mega bytes


rem Print archi - memory message
echo %msg-archi% - %msg-memory%


rem fc-21.5.2013 managed splashscreen on clusters
java %splashoption% -Xmx%memo% -cp ./class;./ext/* capsis.app.Starter %*

rem fc-18.11.2011 Removed all specific encoding notifications
rem java -splash:etc/splash.png -Xmx%memo% -cp ./class;./ext/* capsis.app.Starter %*
rem java -splash:etc/splash.png -Dfile.encoding=ISO8859-15 -Xmx%memo% -cp ./class;./ext/* capsis.app.Starter %1 %2 %3 %4 %5 %6 %7 %8 %9


cd %OLDDIR%
documentation/useaspecificjavanotinsystempath.txt · Last modified: 2014/03/24 15:50 by coligny