各位高手:
您们好!
我做了一个javaWeb 应用程序,现在想用 “Inno Setup 编译器” 打包,不知java的环境变量怎么添加;想实现的效果是
当程序安装好后,环境变量也随着配置好。根据选择的安装目录,自动将环境变量装好。谢谢各位了。麻烦告诉一声。
------------------------------- 以下是脚本怎么加 ---------------------------------------------------------
; 脚本由 Inno Setup 脚本向导 生成!
; 有关创建 Inno Setup 脚本文件的详细资料请查阅帮助文档![Setup]
; 注: AppId的值为单独标识该应用程序。
; 不要为其他安装程序使用相同的AppId值。
; (生成新的GUID,点击 工具|在IDE中生成GUID。)
AppId={{978F3205-A281-4ECD-AFAB-5BB49CBACA44}
AppName=javaWeb程序
AppVerName=我的程序 1.5
AppPublisher=我的公司
AppPublisherURL=http://127.0.0.1:8080/
AppSupportURL=http://127.0.0.1:8080/
AppUpdatesURL=http://127.0.0.1:8080/
DefaultDirName=d:\jxc\javaWeb程序
DefaultGroupName=javaWeb程序
LicenseFile=C:\Documents and Settings\Administrator\桌面\新建 文本文档.txt
InfoBeforeFile=C:\Documents and Settings\Administrator\桌面\新建 文本文档.txt
InfoAfterFile=C:\Documents and Settings\Administrator\桌面\新建 文本文档.txt
OutputDir=D:\jxc
OutputBaseFilename=setup
SetupIconFile=C:\Documents and Settings\Administrator\桌面\Cczt.ico
Compression=lzma
SolidCompression=yes[Languages]
Name: "chinesesimp"; MessagesFile: "compiler:Default.isl"[Files]
Source: "F:\项目_备份\mxj\2009-08-04\webjxc\build\web\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; 注意: 不要在任何共享系统文件上使用“Flags: ignoreversion”[Icons]
Name: "{group}\{cm:ProgramOnTheWeb,javaWeb程序}"; Filename: "http://127.0.0.1:8080/"
Name: "{group}\{cm:UninstallProgram,javaWeb程序}"; Filename: "{uninstallexe}"
您们好!
我做了一个javaWeb 应用程序,现在想用 “Inno Setup 编译器” 打包,不知java的环境变量怎么添加;想实现的效果是
当程序安装好后,环境变量也随着配置好。根据选择的安装目录,自动将环境变量装好。谢谢各位了。麻烦告诉一声。
------------------------------- 以下是脚本怎么加 ---------------------------------------------------------
; 脚本由 Inno Setup 脚本向导 生成!
; 有关创建 Inno Setup 脚本文件的详细资料请查阅帮助文档![Setup]
; 注: AppId的值为单独标识该应用程序。
; 不要为其他安装程序使用相同的AppId值。
; (生成新的GUID,点击 工具|在IDE中生成GUID。)
AppId={{978F3205-A281-4ECD-AFAB-5BB49CBACA44}
AppName=javaWeb程序
AppVerName=我的程序 1.5
AppPublisher=我的公司
AppPublisherURL=http://127.0.0.1:8080/
AppSupportURL=http://127.0.0.1:8080/
AppUpdatesURL=http://127.0.0.1:8080/
DefaultDirName=d:\jxc\javaWeb程序
DefaultGroupName=javaWeb程序
LicenseFile=C:\Documents and Settings\Administrator\桌面\新建 文本文档.txt
InfoBeforeFile=C:\Documents and Settings\Administrator\桌面\新建 文本文档.txt
InfoAfterFile=C:\Documents and Settings\Administrator\桌面\新建 文本文档.txt
OutputDir=D:\jxc
OutputBaseFilename=setup
SetupIconFile=C:\Documents and Settings\Administrator\桌面\Cczt.ico
Compression=lzma
SolidCompression=yes[Languages]
Name: "chinesesimp"; MessagesFile: "compiler:Default.isl"[Files]
Source: "F:\项目_备份\mxj\2009-08-04\webjxc\build\web\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; 注意: 不要在任何共享系统文件上使用“Flags: ignoreversion”[Icons]
Name: "{group}\{cm:ProgramOnTheWeb,javaWeb程序}"; Filename: "http://127.0.0.1:8080/"
Name: "{group}\{cm:UninstallProgram,javaWeb程序}"; Filename: "{uninstallexe}"
解决方案 »
- s2sh使用cos上传问题
- AXIS2出现The server did not recognise the action which it received问题
- 帮我看看hibernate sql server的配置代码谢谢。
- SSH2的问题 急!!!!
- 请教Quartz的SimpleTrigger、CronTrigger的未触发指令的几个调度策略的具体意思是什么?英文太烂,高手帮忙解释一下,谢谢!
- security
- jsf+spring+hibernate增删改简明示例
- 方法?还是?
- AOP可以方便的启用或禁用吗?
- JBuilder建CMP的查找方法中的SQL指定义。
- JDBC连接的问题。
- hibernate 更新数据 tomcat
[Code]// Version log:
// 09/22/2005: Initial release (axis23(at)gmail.com)
// Based in 'Native ISX procedures for PATH modification' from Thomas Vedel ('ModifyPath.iss')const
// Modification method
vmAddOnlyIfVarDoesNotExists = $1; // Add Var only is this Var doesn't exists
vmAddAllways = $2; // Add Var allways// Scope
vsCurrentUser = 1; // Add Var for current user
vsAllUsers = 2; // Add Var for all users// Error results
mvOK = 0; // No errors
mvMissingRights = -1; // User has insufficient rights
mvAutoexecNoWriteacc = -2; // Autoexec can not be written (may be readonly)
mvBothMethods = -3; // Error if invoque function with two methods{ Helper function: Modify Var on Windows 9x }
function ModifyVar9x(VarName, VarValue: string; Method: integer): integer;
var
AutoexecLines: TStringList;
ActualLine: String;
VarLineNos: TStringList;
FirstVarLineNo: Integer;
VarExists: boolean;
LineNo, CharNo, Index: integer;TempString: String;
TempVarName: String;
TempVarName_comp: String;begin
// Expect everything to be OK
result := mvOK;// Create stringslists
AutoexecLines := TStringList.Create;
VarLineNos := TStringList.Create;
TempVarName := 'SET ' + uppercase(VarName) + '=';
TempVarName_comp := 'SET' + uppercase(VarName) + '=';// Create VarExists
VarExists := false;// Read existing Var
LoadStringFromFile('c:Autoexec.bat', TempString);
AutoexecLines.Text := TempString;
VarLineNos.Clear;
// Read Autoexec line by line
for LineNo := 0 to AutoexecLines.Count - 1 do begin
ActualLine := AutoexecLines.Strings[LineNo];
// Check if line starts with 'Varname=' after first stripping spaces and other "fill-chars"
if Pos('=', ActualLine) > 0 then
begin
for CharNo := Pos('=', ActualLine)-1 downto 1 do
if (ActualLine[CharNo]=' ') or (ActualLine[CharNo]=#9) then
Delete(ActualLine, CharNo, 1);
if Pos('@', ActualLine) = 1 then
Delete(ActualLine, 1, 1);
if (Pos(TempVarName_Comp, uppercase(ActualLine))=1) then
begin
ActualLine := TempVarName + VarValue;
// Update list of line numbers holding VarName variables
VarLineNos.Add(IntToStr(LineNo));
VarExists :=true;
end;
end;
end;// Save first line number in Autoexec.bat which modifies Var environment variable
if VarLineNos.Count > 0 then
FirstVarLineNo := StrToInt(VarLineNos.Strings[0])
else
FirstVarLineNo := 0;// Only change autoexec if method permit this
if ((Method = vmAddAllways) or ((Method = vmAddOnlyIfVarDoesNotExists) and (VarExists=false))) then
begin
// Write Modified Var back to Autoexec.bat
// First delete all existing Var references from Autoexec.bat
Index := VarLineNos.Count-1;
while (Index>=0) do
begin
AutoexecLines.Delete(StrToInt(VarLineNos.Strings[Index]));
Index := Index-1;
end;
// Then insert new Var variable into Autoexec.bat
if(VarExists=false) then
FirstVarLineNo := AutoexecLines.Count;
AutoexecLines.Insert(FirstVarLineNo, TempVarName+VarValue);
// Delete old Autoexec.bat from disk
if not DeleteFile('c:Autoexec.bat') then
result := mvAutoexecNoWriteAcc;
Sleep(500);
// And finally write Autoexec.bat back to disk
if not (result=mvAutoexecNoWriteAcc) then
SaveStringToFile('c:Autoexec.bat', AutoexecLines.Text, false);
end;// Free stringlists
VarLineNos.Free;
AutoexecLines.Free;
end; // ModifyVar9x
{ Helper function: Modify Var on Windows NT, 2000 and XP }
function ModifyVarNT(VarName, VarValue: string; Method, Scope: integer): integer;
var
RegRootKey: integer;
RegSubKeyName: string;
RegValueName: string;
ResultVar: string;
OK: boolean;
begin
// Expect everything to be OK
result := mvOK;// Initialize registry key and value names to reflect if changes should be global or local to current user only
case Scope of
vsCurrentUser:
begin
RegRootKey := HKEY_CURRENT_USER;
RegSubKeyName := 'Environment';
RegValueName := VarName;
end;
vsAllUsers:
begin
RegRootKey := HKEY_LOCAL_MACHINE;
RegSubKeyName := 'SYSTEMCurrentControlSetControlSession ManagerEnvironment';
RegValueName := VarName;
end;
end;// Read current Var value from registry
OK := RegQueryStringValue(RegRootKey, RegSubKeyName, RegValueName, ResultVar);// Write new Var value to registry
if ((Method = vmAddAllways) or ((Method = vmAddOnlyIfVarDoesNotExists) and (OK=false))) then
begin
if not RegWriteStringValue(RegRootKey, RegSubKeyName, RegValueName, VarValue) then
begin
result := mvMissingRights;
Exit;
end;
end;
end; // ModifyVarNT
{ Main function: Modify Var }
function ModifyVar(VarName, VarValue: string; Method, Scope: integer): integer;
begin
// Check if both add and remove has been specified (= error!)
if (Method and (vmAddOnlyIfVarDoesNotExists and vmAddAllways)) > 0 then
begin
result := mvBothMethods;
Exit;
end;// Test if Win9x
if InstallOnThisVersion('4,0','0,0') = irInstall then
ModifyVar9x(VarName,VarValue, Method);// Test if WinNT, 2000 or XP
if InstallOnThisVersion('0,4','0,0') = irInstall then
ModifyVarNT(VarName, VarValue, Method, Scope);
end; // ModifyVar
其实,只要知道怎么动态获得安装路径,然后改写bat文件,再去执行bat文件就可以设置环境变量了。
关键是,如何自动改写bat文件呢?