Wil*_*son 16 java installer tomcat web-applications
如何使用结合了tomcat,mysql和war文件的Java创建一个安装程序并出来一个最终的exe?
可能的选项已经在很多问题中得到了很好的解决,特别是:
...以及标记为java +安装程序的其他问题
虽然不可否认,这些问题中提到的一些选项无法生成自给自足的.exe安装程序.如果商业工具适合你,我个人推荐install4j(费用$); 除此之外,它还可以创建.exe安装程序(有关我使用它的经验的详细信息).或者,对于使用Java程序生成Windows可执行文件的更简单,免费的工具,请参阅Launch4j.
根据OP的评论更新我的install4j推荐:
是的,exe安装程序需要一次性安装tomcat,mysql,web应用程序和db脚本.最后,用户只需要启动tomcat和mysql服务.转到浏览器可以访问Web应用程序.
使用install4j,
我刚刚用install4j做了类似的事情(捆绑应用程序服务器,webapp,运行数据库脚本,以及许多其他东西;但是没有捆绑数据库),所以我相对肯定它可以完成.我不知道你是否可以使用诸如Launch4j之类的免费工具(轻松地)做到这一点.
小智 5
这是我对这个问题的简约解决方案.我已经下载了没有安装程序的tomcat和MySQL安装,所以我只是解压缩它们,我试过它们工作正常.此时您将war文件安装到tomcat,并将相关模式安装到mysql.因此,当您复制文件夹时,一切都将被复制.你可以测试它是如何工作的.可能你可以对它们进行一些调整,但对我来说它们开箱即用,因为我的应用并不是那么苛刻.除此之外,我已经下载了32位和64位版本的程序,因此它们都可以安装.我使用Inno设置来打包安装程序.基本上它只通过选择32或64架构来复制这两个文件夹,并安装tomcat和mysql作为windows服务.
[Setup]
AppName=MyApp
AppVersion=1.0
DefaultDirName={pf}\MyApp
DefaultGroupName=MyApp
Compression=lzma2
SolidCompression=yes
OutputDir=output   
; "ArchitecturesInstallIn64BitMode=x64" requests that the install be
; done in "64-bit mode" on x64, meaning it should use the native
; 64-bit Program Files directory and the 64-bit view of the registry.
; On all other architectures it will install in "32-bit mode".
ArchitecturesInstallIn64BitMode=x64
; Note: We don't set ProcessorsAllowed because we want this
; installation to run on all architectures (including Itanium,
; since it's capable of running 32-bit code too).
[Files]              
; Install x64 if running in 64-bit mode (x64; see above), x86.exe otherwise.   
Source: "mysql-5.5.13-winx64\*.*"; DestDir: "{app}\mysql"; Check: Is64BitInstallMode; Flags: ignoreversion recursesubdirs createallsubdirs 
Source: "mysql-5.5.13-win32\*.*"; DestDir: "{app}\mysql"; Check: not Is64BitInstallMode; Flags: ignoreversion recursesubdirs createallsubdirs  
; Install x64 if running in 64-bit mode (x64; see above), x86.exe otherwise.   
Source: "apache-tomcat-6.0.32-x64\*.*"; DestDir: "{app}\tomcat"; Check: Is64BitInstallMode; Flags: ignoreversion recursesubdirs createallsubdirs 
Source: "apache-tomcat-6.0.32-x86\*.*"; DestDir: "{app}\tomcat"; Check: not Is64BitInstallMode; Flags: ignoreversion recursesubdirs createallsubdirs
;   
Source: "start.bat"; DestDir: "{app}"; DestName: "start.bat"; 
Source: "stop.bat"; DestDir: "{app}"; DestName: "stop.bat"; 
[Icons]    
Name: "{group}\Start MyApp"; Filename: "{app}\start.bat"
Name: "{group}\Stop MyApp"; Filename: "{app}\stop.bat"
[Run]     
; install mysql and tomcat as services
Filename: "{app}\mysql\bin\mysqld.exe"; Parameters: "--install MyApp_MySQL"
Filename: "{app}\tomcat\bin\service.bat"; Parameters: "install"   
Filename: "{app}\start.bat"; Description: {cm:LaunchProgram,{cm:AppName}}; Flags: nowait postinstall skipifsilent
[UninstallRun]   
; uninstall mysql and tomcat as services  
Filename: "{app}\stop.bat";
Filename: "{app}\mysql\bin\mysqld.exe"; Parameters: "--remove MyApp_MySQL" 
Filename: "set"; Parameters: "CATALINA_HOME={app}\tomcat"
Filename: "{app}\tomcat\bin\tomcat6.exe"; Parameters: "//DS//MyApp_Tomcat"
[CustomMessages]
AppName=MyApp
LaunchProgram=Start MyApp after finishing installation
现在,您只需启动/停止注册服务即可运行您的应用程序.的start.bat
NET START MyApp_MySQL
NET START MyApp_Tomcat
START "" "http://localhost:8080/myapp/" 
stop.bat且
NET STOP MyApp_MySQL
NET STOP MyApp_Tomcat
对我来说它工作得很好.
问候
阿米尔
| 归档时间: | 
 | 
| 查看次数: | 20525 次 | 
| 最近记录: |