简体   繁体   English

BKM向最终用户交付基于Web的Java应用程序+ Jetty + JRE

[英]BKM to deliver a web-based java application + Jetty + JRE to end-user

I have a Java application with a web-based UI (using Vaadin framework). 我有一个带有基于Web的UI(使用Vaadin框架)的Java应用程序。 I want users to get the app and run on their local machines. 我希望用户获得该应用程序并在其本地计算机上运行。 Some users can be not very technical, so need to make this as simple and foolproof as possible for them. 一些用户可能不是很熟练,所以需要使他们尽可能简单和简单。

Possible solutions: 可能的解决方案:

  1. Create a distributive with the webapp + Jetty + batch and shell scripts to start the app. 使用webapp + Jetty +批处理和shell脚本创建一个发行版以启动该应用程序。 maybe include JRE too. 也许也包括JRE。 The User Story will be: download some ZIP file, unpack and run "start.bat" or "start.sh". 用户故事将是:下载一些ZIP文件,解压缩并运行“ start.bat”或“ start.sh”。 The script will start Jetty and maybe launch a web browser with "http://localhost:8080/myapp" URL. 该脚本将启动Jetty,并可能启动带有“ http:// localhost:8080 / myapp” URL的Web浏览器。 There should be no magic with "installing JRE" or "what's your Java Home" or "Your JRE is too old", etc... This would scare the hell out of many non-technical people. “安装JRE”或“ Java的家在哪里”或“您的JRE太旧了”,等等,应该没有魔术。这会吓到很多非技术人员。 Difficulties here: what if the machine does not have JRE? 这里的困难:如果计算机没有JRE怎么办? I'd like to avoid creating 3 different distributives with JREs (for Win/Linux/MacOS). 我想避免使用JRE创建3个不同的发行版(对于Win / Linux / MacOS)。 Packaging all 3 JREs into the same distributive seems like an overkill. 将所有3个JRE打包到同一个发行版中似乎是过大了。

  2. Another approach I see is using Java Web Start. 我看到的另一种方法是使用Java Web Start。 My app would be downloaded through JWS with Jetty JAR as a dependency and start the embedded Jetty in this case. 我的应用程序将通过Jetty JAR作为依赖通过JWS下载,并在这种情况下启动嵌入式Jetty。 The User Story: click a button on some website to launch the app locally. 用户故事:单击某些网站上的按钮以在本地启动该应用程序。 I remember having problems with using JWS from behind a proxy ~5 years ago: the dependencies could not be loaded. 我记得大约5年前从代理后面使用JWS时遇到问题:无法加载依赖项。 Not sure if it's still a problem. 不知道这是否仍然是一个问题。 I haven't used JWS since then, so I'm very familiar with it. 从那时起我就再没有使用过JWS,因此我对此非常熟悉。 Another problem with JWS is that it will require people to have internet connection to launch the app (at least for the 1st time or maybe every time), which is not always possible (some organizations can't be connected to the Internet). JWS的另一个问题是,它要求人们必须连接到互联网才能启动该应用程序(至少是第一次或每次),但这并非总是可能的(某些组织无法连接到Internet)。 AFAIK, the last JWS suggests installing JRE if it's not there yet, so this should be easy for end-users. AFAIK,最后一个JWS建议安装JRE(如果尚未安装),因此对于最终用户来说应该很容易。 That's probably it for the potential issues with JWS (?). 可能就是JWS(?)的潜在问题。

  3. Finally, the last approach is to pack everything with something like launch4j or InstallShield or whatever. 最后,最后一种方法是使用launch4j或InstallShield之类的东西打包所有东西。 Hopefully those programs are capable of installing JRE is it's not present yet and also can run in headless mode (for servers). 希望那些程序能够安装JRE(如果尚不存在),并且还可以在无头模式下运行(对于服务器)。

So far option 2 looks the easiest for most users, assuming that JWS can do what I need. 到目前为止,假设JWS可以满足我的要求,那么对于大多数用户来说,选项2看起来是最简单的。

So, my questions are these: 所以,我的问题是:

  • Which additional pitfalls do you see with these 3 solutions? 您会发现这3个解决方案还有哪些陷阱?
  • Which one would you prefer in my case? 在我的情况下,您会选择哪一个?

I prefer a combination of the solutions 1 and 3. I mean: 我更喜欢将解决方案1和3结合使用。我的意思是:

  • First, build a jar with an embedded Jetty that runs your webapp. 首先,使用运行您的web应用程序的嵌入式Jetty构建一个jar。 This jar must have a main class (that starts an embedded Jetty) and a MANIFEST.MF configured with the "Main-Class" property, so this jar can be runned with: " java -jar myEmbeddedWebApp.jar ". 该jar必须具有一个主类(启动嵌入式Jetty)和一个配置有“ Main-Class”属性的MANIFEST.MF,因此可以使用以下名称运行该jar:“ java -jar myEmbeddedWebApp.jar ”。
  • Then, use launch4j to build an exe wrapper for that jar, eg myEmbeddedWebApp.exe 然后,使用launch4j为该jar创建一个exe包装器,例如myEmbeddedWebApp.exe

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM