是否有一种机制可以使用自己的 JRE 分发应用程序?

发布于 2024-08-30 17:08:00 字数 647 浏览 5 评论 0原文

这些优秀的人是我的用户:http://www.youtube.com/watch?v=o4MwTvtyrUQ< /a>

如果您不想欣赏视频,这里的要点是:我的用户无法区分文件和文件夹、浏览器和网站。

我需要创建一个 Java Web 应用程序(Tomcat 或 Jetty)并将其部署在尽可能多的计算机(Windows 和 Mac)中。

问题是:是否有一种机制可以使用自己的 JRE 分发应用程序? (在Tcl世界里有starpacks和starkits,在Python世界里有py2exe和其他,这就是这个想法)。而且,这合法吗?我知道虚拟机是开源的,但我不清楚这些库,我知道 GNU Classpath,但我不知道所有的包是否都在那里。

我不想依赖已安装的 JRE 或具有足够权限来安装 JRE 的用户。在 Mac 上,我不想依赖 Apple(我不得不从 Tiger 切换到 Snow Leopard 只是为了拥有 Java 1.6,我不能让我的用户处于那个位置)

非常感谢任何信息。 谢谢! jb

编辑: 我想知道是否可以将 JRE 文件夹粘贴到我的应用程序文件夹下。这是允许的吗?

These fine folks are my users: http://www.youtube.com/watch?v=o4MwTvtyrUQ

If you don't want to enjoy the video here is the gist: my users can't tell between a file and a folder, between a browser and a web site.

I need to create a Java web app (Tomcat or Jetty) and deploy it in as many of their computers, Windows and Mac.

The question is: Is there a mechanism to distribute an app with its own JRE? (in the Tcl world there are starpacks and starkits, in the Python world there's py2exe and others, that's the idea). And also, is it legal? I know the VM is open source but I'm not clear about the libraries, and I know about GNU Classpath but I don't know if all the packages are there.

I don't want to depend on the installed JRE or on the user having enough privileges to install one. On the Mac I don't want to depend on Apple (I had to switch from Tiger to Snow Leopard just to have Java 1.6, I can't put my users in that position)

Any info greatly appreciated.
Thanks!
jb

edit: I'm wondering if I can just paste the JRE folder under my app folder. Is that allowed?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

自此以后,行同陌路 2024-09-06 17:08:00

我们在工作场所使用 Install4j。它负责安装并在需要时安装 JRE。但它不是免费的。至少我们使用的版本没有为 Mac 用户提供捆绑的 JRE。但据我所知,这是由于苹果的一些限制。 Mac 附带了自己的 JRE,如果您的用户拥有 Mac,则可以安全地假设他们已安装 JRE。不过,如果 JRE 的版本比您喜欢的版本旧,那么他们将必须使用软件更新来检查是否有新版本可用并安装它。

We use Install4j at our workplace. It takes care of installation and installs the JRE if needed too. Its not free though. And at least the version we use doesn't provide Mac users with a bundled JRE. But as far as I was able to find out, that was due to some restrictions by Apple. Macs come with their own JRE and if your user has a Mac, its safe to assume they have a JRE installed. Although, if the JRE is an older version than the one you like, then they would have to use Software Update to check if a newer version is available and install it.

怕倦 2024-09-06 17:08:00
    To run your application, a user needs the J2SE Runtime Environment,
    which is freely available from Sun. Or, You can redistribute the 
    J2SE Runtime Environment for free with your application, according 
    to the terms of the Runtime Environment's license.

来自 http://java.sun.com/j2se/1.5.0/jre /README

我还没有读过细则,似乎Sun打算让人们重新分发JRE。另外,有许多产品(例如 install4j)可以让您轻松地重新分发 JRE,因此这似乎是合法的。

至于其余部分,您还可以将 tomcat 与内置服务捆绑在一起,以便您的应用程序自动启动,并在桌面上创建本地 Web 应用程序的快捷方式,这样用户就无需输入 ht tp://localhost :8080/web应用程序。有大量的 FOSS 安装程序(例如 izpack)允许您的用户安装软件包并管理桌面快捷方式的创建。您提到不喜欢使用安装程序,但即使解压缩也是一种安装 - 您的用户必须选择他们具有写入权限的目录,这与成熟的安装程序没有什么不同。

但是,考虑到用户的能力,本地安装的解决方案是否最适合他们?在线解决方案可能提供更简单的部署(例如 Java Web Start,甚至作为小程序。)

    To run your application, a user needs the J2SE Runtime Environment,
    which is freely available from Sun. Or, You can redistribute the 
    J2SE Runtime Environment for free with your application, according 
    to the terms of the Runtime Environment's license.

From http://java.sun.com/j2se/1.5.0/jre/README

I haven't read the fine print, it seems that Sun intends for people to redistribute the JRE. Also, there are many products (e.g. install4j) that make it easy for you to redistribute the JRE, so it seems to be legal.

As to the rest of it, you could then also bundle tomcat, with the built in Service so your app is automatically started, and create a shortcut on the desktop to your local webapp, so users are freed from typing ht tp://localhost:8080/webapp. There are plenty of FOSS installers (e.g. izpack) that will allow your users to install the package, and manage creation of desktop shortcuts. You mentioned preferring not using an installer, but even unzipping is kind of installing - your users have to choose a directory that they have write access to, and this is no different with a fully fledged installer.

But, given the capabilities of your users, is a locally installed solution the most suited to them? An online solution might offer simpler deployment (e.g. Java web start, or even as an applet.)

纵山崖 2024-09-06 17:08:00

在 OS X 中,你几乎只能使用 Apple 为你提供的任何东西。在其他平台中,不需要运行 JRE 安装程序(您正确地指出您的用户可能无法执行此操作),只需将 JRE 文件夹与您的应用程序捆绑在一起即可。这就是我们许多用户所做的(我的公司有一个名为 InstallBuilder 的多平台安装程序),并且我们打包了许多 Java网络应用程序就是这样。您可以在 BitNami 上查看其中一些(它们都是免费的)

In OS X you pretty much are stuck with whatever Apple provides you. In other platforms, it is not needed to run a JRE installer (which you correctly point out your users may not be able to do), just bundle a JRE folder alongside your app. That is what many of our users do (my company has a multiplatform installer called InstallBuilder) and we have packaged many Java web apps that way. You can take a look at some of them at BitNami (they are all free)

乱世争霸 2024-09-06 17:08:00

或者简而言之,您可以尝试以下操作:

为您的应用程序创建一个自可执行 jar 文件。

  • 为您的用户提供小型 JRE 设置(jre6u7 约 15MB)以及您的应用程序。
  • 现在创建一个批处理文件(适用于 Windows),它将首先执行 JRE 安装程序。
  • 然后选择已安装 JRE 的“bin”文件夹的路径。
  • 现在,在此之后在脚本中写入“java -jar yourAppName.jar”以运行可执行 jar 文件。

例如:对于 win.bat 编写以下内容:

jre-6u7-windows-i586-p  :: this will start the JRE installer
C:\Program Files\Java\jre1.6.0_07\bin\java -jar yourAppName.jar  :: this will start your app

您也可以为 Mac 和 Linux 创建此类脚本。

Or in short, you can try this:

Make a self executable jar file of your app.

  • Provide your users small JRE setup (appx 15MB for jre6u7) along with your app.
  • Now create a batch file(for windows) which will first execute the JRE installer.
  • Then select path to installed JRE's 'bin' folder.
  • Now after this write 'java -jar yourAppName.jar' in the script to run your executable jar file.

eg: for win.bat write the following:

jre-6u7-windows-i586-p  :: this will start the JRE installer
C:\Program Files\Java\jre1.6.0_07\bin\java -jar yourAppName.jar  :: this will start your app

You can create such scripts for Mac and Linux also.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文