@echo on
rem fixext.btm fix the ext directories for Java  2017-03-01 (MUST BE RUN AS ADMINISTRATOR)
rem Propagated as a snippet.
rem this file must be tailored before each use.
rem propagate changes to killanextfile.btm
pushd

echo building environment sets...

rem fix system copies of the environment, and local environment.

rem F:\Program Files (x86)\VC\bin\vcvars32.bat sets C++ sets up

set /E /S antVersion=1.10.1
set /E /S ANT_HOME=F:\Program Files (x86)\apache-ant-%antVersion%
rem ANT_HOME\bin must be on the path
set /E /S ANT_OPTS=-Xms256m -Xmx3000m -XX:ReservedCodeCacheSize=192m -ea -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -Djsse.enableSNIExtension=false -XX:+UseCodeCacheFlushing -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50

rem configure browser
set /E /S BROWSER="F:\Program Files (x86)\Mozilla Firefox\firefox.exe"
rem set /E /S BROWSER="F:\Program Files (x86)\Opera\launcher.exe"
rem set /E /S BROWSER="C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"

set /E /S CATALINA_HOME=F:\Program Files\apache-tomcat-%TomcatVersion%
set /E /S CLASSPATH=.;E:\;E:\exper

set /E /S ComSpec=F:\Program Files\JPSoft\TCMD20\TCC.EXE /E:2500 /C
set /E /S DevEnvDir=F:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\
set /E /S EDIT="F:\program files\jEdit\jedit.exe"
set /E /S ExtensionSdkDir=C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0\ExtensionSDKs
set /E /S Framework35Version=v3.5
set /E /S FrameworkDIR32=C:\Windows\Microsoft.NET\Framework\
set /E /S FrameworkDir=C:\Windows\Microsoft.NET\Framework\
set /E /S FrameworkVersion32=v4.0.30319
set /E /S FrameworkVersion=v4.0.30319
set /E /S HTMLValidatorDir=F:\Program Files (x86)\HTMLValidator170
rem .IntelliJIdea2017.1 needs to be manually updated everywhere on website
rem update support.JDKandJREVersions
rem also manually update vercheck
rem F:\Program Files (x86)\JetBrains\IntelliJ IDEA 2017.1
set /E /S INTELLIJ_DIR=IntelliJ IDEA 2017.1
set /E /S INTELLIJ_FULL_VERSION=2017.2
rem also fix build.java

set /E /S JDKVersion=1.8.0_131
set /E /S JREVersion=1.8.0_131

rem installl JDK64 JRE64 JRE32 DOCS
rem run fixext as administrator
rem customise E:\env\rootcerts\certimportone.btm
rem run E:\env\rootcerts\certimportall.btm
rem run newBuild
rem run flipjdk
rem polish jdk.html jre.html
rem associate *.jar with java.exe

rem if you change the above, remember to do a certimportall.btm
set /E /S JDK32=E:\Program Files (x86)\Java\jdk%JDKVersion%
set /E /S JDK64=E:\Program Files\Java\jdk%JDKVersion%
set /E /S JRE32=C:\Program Files (x86)\Java\jre%JDKVersion%
set /E /S JRE64=C:\Program Files\Java\jre%JDKVersion%
set /E /S JAVA_HOME=E:\Program Files\java\jdk%JDKVersion%
set /E /S JAVA_OPTIONS=-Xms256m -Xmx4000m -XX:ReservedCodeCacheSize=192m -ea -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -Djsse.enableSNIExtension=false -XX:+UseCodeCacheFlushing -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50

set /E /S INCLUDE=F:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE;C:\Program Files (x86)\Windows Kits\8.0\include\shared;C:\Program Files (x86)\Windows Kits\8.0\include\um;C:\Program Files (x86)\Windows Kits\8.0\include\winrt;F:\Program Files (x86)\VC\include;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\include\um;C:\Program Files (x86)\Windows Kits\8.0\include\winrt;%JDK64\include;%DK64\include\win32

set /E /S LIB=F:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\LIB;C:\Program Files (x86)\Windows Kits\8.0\lib\win8\um\x86;F:\Program Files (x86)\VC\LIB;C:\Program Files (x86)\Windows Kits\8.0\lib\win8\um\x86
set /E /S LIBPATH=C:\Windows\Microsoft.NET\Framework\v4.0.30319;C:\Windows\Microsoft.NET\Framework\v3.5;F:\Program Files (x86)\Microsoft Visual Studio11.0\VC\LIB;C:\Program Files (x86)\Windows Kits\8.0\References\CommonConfiguration\Neutral;C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0\ExtensionSDKs\Microsoft.VCLibs\11.0\References\CommonConfiguration\neutral;C:\Windows\Microsoft.NET\Framework\v4.0.30319;C:\Windows\Microsoft.NET\Framework\v3.5;F:\Program Files (x86)\VC\LIB;C:\Program Files (x86)\Windows Kits\8.0\References\CommonConfiguration\Neutral;C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0\ExtensionSDKs\Microsoft.VCLibs\11.0\References\CommonConfiguration\neutral;
set /E /S OLDSR=F:\Program Files\SR\sr64.exe
set /E /S SRBE=F:\Program Files\RSBE\ReplaceStudioBE64.exe
set /E /S TidyDir=F:\Program Files\tidy
set /E /S TreeExclude=C:\Windows;C:\Windows.old
set /E /S VS110COMNTOOLS=F:\Program Files (x86)\Common7\Tools\
set /E /S WINZIP=F:\Program Files\WinZip
rem billion
set /E /S ageofearth=4.543

rem million
set /E /S ageofhumanity=2.8
rem billion
set /E /S ageoflife=3.7
rem billion
set /E /S ageofuniverse=13.82
set /E /S awsassociatetag=canadianmindprod
set /E /S awsassociatetagca=canadianmin07-20
set /E /S cert=mindprodcert2017rsa
rem set /E /S configuration=ConfigurationForMindprodCa
rem set /E /S configuration=ConfigurationForMindprodCom
set /E /S configuration=ConfigurationForMindprod
set /E /S csvcount=30
set /E /S deaththreats=3,200
set /E /S denominations=43,000
set /E /S gods=60,000
rem historians of Jesus time/place.
set /E /S historians=121
rem ratio of Palestinians to Israelis killed in current conflict.  2014-08-09
set /E /S israelkillratio=28

set /E /S jetVersion=jet12.0-pro-x86
set /E /S jetProfile=1.8.0_121
rem if you change the above, remember to do a certimportall.btm, and fix Build.java

set /E /S keystore=C:/Users/Roedy
set /E /S methanepotency=25
set /E /S pgdata=F:\Program Files\PostgreSQL\%postgreVersion%\data
set /E /S pgdatabase=postgres
set /E /S pglocaledir=F:\Program Files\PostgreSQL\%postgreVersion%\share\locale
set /E /S pgport=5433
set /E /S pguser=postgres
rem https://www.census.gov/popclock/
set /E /S population=7.381

set /E /S postgreVersion=9.4
set /E /S temp=D:\temp
set /E /S threats=380,000
set /E /S tmp=D:\temp
set /E /S tomcatVersion=8.0.11
set /E /S toppopulation=12
set /E /S truezipVersion=7.5.5
set /E /S truezipforBackupToZipVersion=6.8.1
set /E /S trumpaccusers=18
set /E /S trumpaccuserdate=2016-10-23
rem in trillions
set /E /S usdebt=$18.9

set /E /S PATH=%SystemRoot%\system32;^
%SystemRoot%;^
%SystemRoot%\System32\Wbem;^
.;^
E:\Program Files\Java\jdk%JDKVersion%\bin;^
E:\env;^
E:\sys;^
F:\Program Files (x86)\%jetVersion%\bin;^
F:\Program Files\JPSoft\TCMD20;^
F:\Program Files\vslick\win;^
F:\Program Files (x86)\apache-ant-%antVersion%\bin;^
F:\Program Files\TortoiseSVN\bin;^
F:\Program Files (x86)\asm;^
F:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow;^
F:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\;^
F:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN;^
F:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools;^
C:\Windows\Microsoft.NET\Framework\v4.0.30319;^
C:\Windows\Microsoft.NET\Framework\v3.5;^
F:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\VCPackages;^
C:\Program Files (x86)\Windows Kits\8.0\bin\x86;^
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools;^
F:\Program Files (x86)\Common7\IDE\CommonExtensions\Microsoft\TestWindow;^
F:\Program Files (x86)\Common7\IDE\;^
F:\Program Files (x86)\VC\BIN;^
F:\Program Files (x86)\Common7\Tools;^
C:\Windows\Microsoft.NET\Framework\v4.0.30319;^
C:\Windows\Microsoft.NET\Framework\v3.5;^
F:\Program Files (x86)\VC\VCPackages;^
C:\Program Files (x86)\Windows Kits\8.0\bin\x86;^
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools

copy E:\env\genjar\genjar.jar "F:\Program Files (x86)\apache-ant-%antVersion%\lib\GenJar.jar"

rem do not reveal Roedy's secret keys in script.
call E:\env\setsecretkeys.btm

rem don't embed actual passwords in this public script, but we display them
echo. awsaccesskeyid=%awsaccesskeyid%
echo. awssecretaccesskey=%awssecretaccesskey%
echo. cacertspassword=%cacertspassword%
echo. jarsignerpassword=%jarsignerpassword%

echo key path vars:
echo E:\Program Files\Java\jdk%JDKVersion%\bin
echo F:\Program Files (x86)\%jetVersion%\bin
echo F:\Program Files (x86)\apache-ant-%antVersion%\bin

pause
echo on

set /E /S JDK32=E:\Program Files (x86)\Java\jdk%JDKVersion%
set /E /S JDK64=E:\Program Files\Java\jdk%JDKVersion%
set /E /S JRE32=C:\Program Files (x86)\Java\jre%JDKVersion%
set /E /S JRE64=C:\Program Files\Java\jre%JDKVersion%

rem propagate unlimited encryption files
copy C:\UnlimitedJCEPolicyJDK8\local_policy.jar "%JRE32\lib\security"
copy C:\UnlimitedJCEPolicyJDK8\local_policy.jar "%JRE64\lib\security"
copy C:\UnlimitedJCEPolicyJDK8\local_policy.jar "%JDK64\lib\security"
copy C:\UnlimitedJCEPolicyJDK8\local_policy.jar "F:\Program Files (x86)\JetBrains\%INTELLIJ_DIR%\jre\jre\lib\security"
copy C:\UnlimitedJCEPolicyJDK8\local_policy.jar "F:\Program Files (x86)\%jetVersion\bin\rt\lib\security"
copy C:\UnlimitedJCEPolicyJDK8\local_policy.jar "F:\Program Files (x86)\%jetVersion\profile%jetProfile\jre\lib\security"

rem propagate unlimited encryption files
copy C:\UnlimitedJCEPolicyJDK8\US_export_policy.jar "%JRE32\lib\security"
copy C:\UnlimitedJCEPolicyJDK8\US_export_policy.jar "%JRE64\lib\security"
copy C:\UnlimitedJCEPolicyJDK8\US_export_policy.jar "%JDK64\lib\security"
copy C:\UnlimitedJCEPolicyJDK8\US_export_policy.jar "F:\Program Files (x86)\JetBrains\%INTELLIJ_DIR%\jre\jre\lib\security"
copy C:\UnlimitedJCEPolicyJDK8\US_export_policy.jar "F:\Program Files (x86)\%jetVersion\bin\rt\lib\security"
copy C:\UnlimitedJCEPolicyJDK8\US_export_policy.jar "F:\Program Files (x86)\%jetVersion\profile%jetProfile\jre\lib\security"

echo off
pause

rem copy auxiliary jars to the two ext directories JDK/JRE
rem javamail 1.5.6 mail.jar unzipped manually ahead of time, and put in extprop
rem IntelliJ @Nullable @NotNull support
copy "F:\Program Files (x86)\JetBrains\%INTELLIJ_DIR%\redist\annotations.jar" E:\env\extprop
copy "E:\Program Files\Java\jdk%JDKVersion%\lib\tools.jar" E:\env\extprop
rem proof list
dir E:\env\extprop\*.*
echo about to propagate these files into various Java ext directories.
unset confirm
E:\sys\confirm.exe
if errorlevel  1 goto done

rem 64 bit JRE
copy E:\env\extprop\*.*  "C:\Program Files\Java\jre%JREVersion%\lib\ext"

rem 32 bit 8
copy E:\env\extprop\*.*  "C:\Program Files (x86)\Java\jre%JREVersion%\lib\ext"

rem default 64-bit JRE for intellij
copy E:\env\extprop\*.* "F:\Program Files (x86)\JetBrains\%INTELLIJ_DIR%\jre\jre\lib\ext"
rem 64 bit JDK
copy E:\env\extprop\*.* "E:\Program Files\Java\jdk%JDKVersion%\jre\lib\ext"
rem 32 bit JDK
rem copy E:\env\extprop\*.* "E:\Program Files (x86)\Java\jdk%JDKVersion%\jre\lib\ext"<span class="

echo.
echo. check that copies all worked, except DESCRIPT.ION
pause

rem proof all sets
set
echo.after making changes to environment variables, remember to start a new DOS box.
echo.Once all set variables are correct, reboot to make the changes visible to scheduled tasks.
echo.And propsnippets.
:done
popd
rem -30-