将 Java 程序添加到 Ubuntu 上下文菜单

发布于 2024-11-28 00:15:39 字数 201 浏览 3 评论 0原文

我正在开发一个与 Ubuntu 一起使用的 Java 桌面应用程序。我需要添加一个上下文菜单项,当用户右键单击文件时出现该菜单项,并将完全限定的文件路径作为参数传递给程序。

搜索后我发现我可以使用Nautilus-Actions,但我想分发我的软件。因此,它应该是一个 shell 脚本或安装选项。

我该如何实现这一目标?

I'm developing a Java desktop application that is to be used with Ubuntu. I need to add a context menu item which appears when the user right clicks on a file and to pass the fully qualified file path as an argument to the program.

After searching I found I can use Nautilus-Actions but I want to distribute my software. Therefore, it should be a shell script or installation option.

How do I achieve that?

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

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

发布评论

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

评论(2

つ可否回来 2024-12-05 00:15:39

部署应用程序。使用 Java Web Start 并对应用程序的文件类型感兴趣。可以使用 JNLPassociation 元素处理(例如 .txt、.rtf、.html) > (应用程序启动)文件。

有关在 JWS 应用程序中使用文件关联的示例,请参阅文件服务演示。 我的 JNLP API 演示。

Deploy the app. using Java Web Start and register an interest in the types of files the app. can process (e.g. .txt, .rtf, .html) using an association element in the JNLP (app. launch) file.

For an example of using file associations in a JWS app., see the file service demo. of my JNLP API demos.

心欲静而疯不止 2024-12-05 00:15:39

您可以从命令行和脚本使用 nautilus-actions:

 man nautilus-actions-new

但是,这需要安装此软件包(我使用的是 Ubuntu Oneiric Alpha,但未安装此软件包),这只能通过将程序打包为 deb 来实现档案。

其他可能性是 Nautilus 脚本,它不需要任何软件包。但它会将您的菜单项放在子菜单中。

像 nautilus-open-terminal 这样的程序可以在没有任何依赖的情况下向 nautilus 菜单添加内容,您可能需要查看其源代码。

You can use nautilus-actions from command line and script:

 man nautilus-actions-new

However, this requires for this package to be installed (I'm using Ubuntu Oneiric Alpha and this package was not installed), which can only be acheived by packing your program as a deb archive.

Other possibility is Nautilus Scripts which does not require any packages. But it will place your menu item in a submenu.

Programs like nautilus-open-terminal add stuff to the nautilus menu without any dependencies, you might want to checkout its source.

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