java – 如何使izpack安装程序.jar文件的.exe文件

我用izpack安装一个安装程序.它在.jar文件中.我想在.exe文件中进行分发.我该怎么办一个简单的方法呢?

解决方法

Andrew总是喜欢从一开始就推广 Java Web Start技术:)这是一个很好的技术.但是,您还需要首先学习技术部件,然后才能开始修补技术部件.

否则,您将使用旧版本的EXE发行版模型,如下所示:

我也不熟悉Izpack.但是,还有类似的独立工具可以实现与izPack可以做什么相结合的结果.我最喜欢的EXE创建和安装工具是从Eclipse IDE运行的launch4j InnoSetup Ant任务.

launch4j一个Java应用程序启动器.
InnoSetup是一个安装创建者
Ant任务帮助开发人员构建和集成步骤.

如何使用launch4j InnoSetup Ant构建任务Eclipse IDE:
http://www.eteks.com/tips/tipCreationExe.html(法语 – 使用Google翻译)

当您正在考虑为Java应用程序分发基于桌面的Windows EXE文件时,还需要考虑目标环境.当您定位到Windows XP或更低版本时,这是很好的.但是,当您希望使其在Windows Vista和Windows 7下正常工作时,它将开始成为一个主要的挫折.

最好不要在Windows Vista / Windows 7下存储需要保存到%ProgramFiles%的应用程序配置,临时文件等,因为它现在变成只读文件夹.使用用户的个人资料文件夹用于此目的.

当然,您可以使用“以管理员身份运行”运行应用程序来绕过它,但涉及以下设置:

Windows Vista and Windows 7 have
introduced a strict user access policy
through the User Access Control (UAC)
prompt feature. The software
installation must be done using a user
account under Administrators group.
All folders under the default Windows’
system Program Files are set to
read-only and it may cause a problem
to non-administrator user accounts
when trying to save something in it. To run Java app using a
non-administrator user account,the
application properties must be set to
enable Run as administrator. A
shortcut shall be created in the
Desktop and be set to enable Run as
administrator
as well.

如何解决以下问题:

(1)AppusermodelID的问题Windows Vista / Windows 7中的Java支持需要以下解决方案:
Launch4j,NSIS,and duplicate pinned Windows 7 taskbar icons

(2)作为Java应用程序的管理员运行的问题需要以下解决方案:
Request admin privileges for Java app on Windows Vista

除此之外,您还需要在64位Windows版本下运行时检查%ProgramFiles%. 32位Windows和64位Windows之间的路径是不一样的.在64位Windows下,所有32位应用程序都将进入%ProgramFiles(x86)%.

因此,在Java程序的文件夹和%ProgramFiles%中安装的子文件夹中使用硬编码的文件路径值时,请小心.最好设置一个可以在以下ISS文件片段中由InnoSetup生成的Windows环境变量.使用Java System.getenv(“MYAPP_HOME”)来检索变量:

[Registry]
Root: HKLM; Subkey: "SYstem\CurrentControlSet\Control\Session Manager\Environment"; Flags: uninsdeletevalue; ValueType: string; ValueName: "MYAPP_HOME"; ValueData: "{app}\"

[Tasks]
Name: modifypath; Description:"Add application directory to your environmental path"; Flags: unchecked

[Run]
Filename: "{app}\MyApp.EXE"; Parameters: """{app}""\"; WorkingDir: "{app}\"; Description: "Run MyApp"; Flags: postinstall Nowait skipifsilent

[Code]

const
    ModpathName = 'modifypath';
    ModpathType = 'system';

function ModpathDir(): Tarrayofstring;
begin
    setArrayLength(Result,1)
    Result[0] := ExpandConstant('{app}');
end;
#include "modpath.iss"

实验享受!

相关文章

最近看了一下学习资料,感觉进制转换其实还是挺有意思的,尤...
/*HashSet 基本操作 * --set:元素是无序的,存入和取出顺序不...
/*list 基本操作 * * List a=new List(); * 增 * a.add(inde...
/* * 内部类 * */ 1 class OutClass{ 2 //定义外部类的成员变...
集合的操作Iterator、Collection、Set和HashSet关系Iterator...
接口中常量的修饰关键字:public,static,final(常量)函数...