使用Java Webstart部署时的依赖问题

发布于 2024-09-14 15:50:32 字数 374 浏览 5 评论 0原文

我正在开发一个 Java 项目,该项目的目录结构如下:

        MainFolder
        /   |     \
Folder1  Folder2  Folder3...
   |
Program.jar|Run.sh

在Folder1 中,我有主 jar 文件以及用于运行程序的 shell 脚本。 在Folder2中,我有xml格式的配置文件,稍后可能会被程序修改 在Folder3 中,我有主程序所依赖的jar 文件。

现在我想使用 Java web-start 部署这个程序。我目前的理解是 web start 允许我们使用 1 个或多个 jar 文件部署程序。我的问题是我还需要目录结构。任何人都可以为此提出解决方案吗。

I am working on a project in Java which has a directory structure something like this:

        MainFolder
        /   |     \
Folder1  Folder2  Folder3...
   |
Program.jar|Run.sh

In Folder1 I have main jar file along with the shell script to run the program.
In Folder2 I'm having configuration files in xml which may later be modified by the program
and In Folder3 I'm having jar files that the main program depends on.

Now I want to deploy this program using Java web-start.My current understanding is that web start allows us to deploy programs using 1 or more jar files.My problem is that I need the directory structure also.Can anyone suggest a solution for this.

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

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

发布评论

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

评论(3

空城缀染半城烟沙 2024-09-21 15:50:32

正如其他人提到的,shell 脚本会引发问题。它“运行程序”具体是做什么的?

对于配置文件 - “文件夹 2”,webstart 提供了 PersistenceService。我有一个小演示。 (1)

就“文件夹 3”中的罐子而言。移动它们以及文件夹 2 和 2 中的 Jar。 1 到名为“lib”的单个目录。主 Jar 和配置文件将被急切地需要,这是 JWS 的默认设置。如果可能不需要立即或根本不需要任何其他 Jars(例如“3”),则应将它们部署为 download='lazy'。

访问本地文件系统 - 用于读取用户提供的输入或写入他们创建的新文件 - JWS 应用程序。 通常需要进行数字签名和信任。但 JWS 还通过 FileContents 对象提供更为有限的访问形式。有关更多详细信息,请参阅演示。下面链接的页面中的文件服务。 (1)

1) JNLP API 演示,包括 PersistenceService 和文件内容对象。

As mentioned by others, the shell script raises problems. What does it do specifically to 'run the program'?

For the configuration files - 'Folder 2', webstart provides the PersistenceService. I have a small demo. (1)

As far as the Jars in 'Folder 3' go. Move them, as well as the Jar's in folders 2 & 1 to a single directory named 'lib'. The main Jar and the configuration files will be required eagerly, which is the default for JWS. If any of the other Jars (ex. '3') might not be needed immediately or at all, they should be deployed as download='lazy'.

To access the local file system - for reading input supplied by the user or writing a new file they created - a JWS app. normally needs to be digitally signed and trusted. But JWS also provides the much more limited form of access through the FileContents object. For more details, see the demo. of the File Service in the page linked below. (1)

1) Demos of the JNLP API, including the PersistenceService & FileContents object.

烂人 2024-09-21 15:50:32

我认为您必须对 webstart 部署的结构进行一些更改(可能将其打包为一个 jar 或一组 jar),并且启动将通过 JNLP、webstart 而不是 Run.sh 完成。

此外,如果您需要写入磁盘的权限,则必须签署您的部署。

请参阅此处

另请查看开发人员指南 关于如何使用 webstart 进行部署

I think you will have to make some changes to the structure for webstart deployment (possibly package it as a jar or set of jars), also the launching will be done via JNLP, by webstart and not Run.sh.

Additionally you will have to sign your deployment if you need permissions to write to the disk.

See the FAQ for webstart here

Also check out the developer guide on how to deploy using webstart

深居我梦 2024-09-21 15:50:32

Java WebStart 不提供任何帮助来根据您的需要创建文件系统 - 它只提供内存的程序组件。

如果你需要这个结构,你需要自己维护它(然后,在哪里?)

如果你唯一需要的是一个要运行的 shell 脚本,你可以将该文件的内容作为资源保存在你的 jar 中,创建一个每次运行时都会创建一个临时文件,将所需的内容放入其中并执行,完成后删除临时文件。请注意,这将带您进入代码签名的奇妙世界,但这是相当乏味的。

Java WebStart does not provide any help in making the filsystem as you need it - it only provides the program components for memory.

If you need this structure, you will need to maintain it yourself (and then, where?)

If the only thing you need is a shell script to run, you can keep the contents of that file as a resource inside your jar, create a temporary file at each run, put the desired contents inside, and execute it, and then delete the temporary file when you are done. Note that this brings you into the wonderful world of code signing which is rather tedious.

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