2

我使用 Apache 服务器和 MySQL 数据库开发了一个 Struts2 项目。

是否可以使这个应用程序成为一个executable应用程序,这样我就不需要将 JDK、Apache 和 MySQL 分别提供给用户。安装程序可以自行安装所有这 3 个。

我也可以这样做,以便只有一个用户可以使用这个应用程序。请告诉我。

4

1 回答 1

3

Usually a Web Application has a central server (with at least: a Java Virtual Machine, a Web Server / Application Server, a Database, and the Web Application contanining the Java code), and all the client computers use their browsers to connect to it.

The kind of application that seems to arise from your description is a monolitic one, like a GUI App made in Swing or in Visual Basic; you install it in the clients, and each one has a copy of each component. If you install it 20 times, you will have 20 database, 20 copies of the files, etc... Even in client-server applications, with centralized database and distributed code, the problems were always client-related; you can't know if the system were you are automatically installing a database, an JDK etc... already has that software, maybe in other versions, or has the environment variables messed up etc. When you need to update the software, or to tune up the system, you need to be physically log to that pc, remotely or by person. This are some of the reasons that led to the choice of preferring Web Applications to distributed applications.

If you need to craft a "package" of your application to be installed in one click by a dumb user (let's say, a portable version of your application, to let your PM perform some Demo in remote locations, or to give it to the big boss to let him see it), you should really evaluate the possibility of creating a Virtual Machine.

A Virtual Machine is a big file (on a hard disk, or read by an USB key, etc) that, once mounted by a Virtualization Software (usually the same software that created the Virtual Machine), will run an entire new OS inside a window of your guest OS.

The leading software to do this is VMWare (the Player is free and cross-platform), alternatively you can use VirtualBox.

Then, you need to

  • download VMWare Player
  • download the ISO of your favourite Linux distribution (I hope you don't use Windows as server)
  • create a, let's say, 10GB partition for your Linux distribution with VMWare Player, and mount it
  • plug the ISO with something like (the free edition of) Daemon Tools
  • install the Linux distribution
  • install and configure all the software you need there (Apache, MySQL, your favourite browsers, etc; JVM usually is already there)
  • install your web application

Then you will have a physical file with a complete Linux OS inside, with all the needed software already tuned up: just distribute this file to Windows, Mac or Linux users, they will only need the VMWare Player installed to run your file and access (their copy of) your application inside the Linux OS.

于 2013-06-12T10:16:17.040 回答