为什么 jEdit 不能与“打开”一起使用? Unix 命令?

发布于 2024-09-15 20:47:38 字数 357 浏览 3 评论 0原文

我最近在 Mac OS 10.6 系统上安装了 jEdit。我希望能够像运行 emacs 一样在终端中运行 jEdit,即“emacs FILE.NAME”。我的计划是编写一个脚本 jedit.sh 包含...

touch $1
open -a /Applications/jEdit.app $1

...其中参数是文件名。奇怪的是,jEdit 已打开,但仅打开默认的新文件,而不是所需的文件。如果我用任何其他应用程序替换“jEdit.app”,例如“TextEdit.app”,它将打开所需的文件。

我有什么遗漏的吗?为什么 jEdit 在与“打开”命令一起使用时的行为与其他应用程序不同?我该如何解决这个问题?

I recently installed jEdit on my Mac OS 10.6 system. I would like to be able to run jEdit in the terminal as I would emacs, i.e. 'emacs FILE.NAME'. My plan was to write a script jedit.sh containing...

touch $1
open -a /Applications/jEdit.app $1

...where the argument is the filename. Strangely, jEdit is opened but only with the default new file, not the desired file. If I substitute the 'jEdit.app' with any other app, say 'TextEdit.app', it opens the desired file.

Is there something I'm missing? Why doesn't jEdit behave like other apps when used with the 'open' command and how can I work around this?

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

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

发布评论

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

评论(3

明媚殇 2024-09-22 20:47:38

首先,“open”不是标准的 UNIX 命令(我认为它是 Mac OS X 特定的命令?)。

此外,jEdit 是用 Java 编写的,因此我假设 jEdit.app 只是一个启动 Java VM 来执行 jedit.jar 的包装器(它运行 /path/to/java -jar /path/to/jedit.jar 或类似的东西,可能还有内存使用的额外选项等)。

在我的 Ubuntu 系统上,jedit 包装器脚本会传递我在命令行中提到的任何文件,并且 jEdit 有效地使用它,因此问题不在于 jEdit 应用程序本身。

结论:看起来 jEdit.app 没有接受您提供的参数来将它们传递到 java 命令行...

作为解决方案,尝试将其启动为 java -jar /path/to/jedit .jar "$@" 来自您的脚本(据我所知,也不需要 touch 行)。

First of all, 'open' is not a standard UNIX command (I assume it's something Mac OS X-specific?).

Furthermore, jEdit is written in Java, so I assume jEdit.app is just a wrapper that starts a Java VM to execute jedit.jar (it runs /path/to/java -jar /path/to/jedit.jar or something like that, probably with extra options for memory usage etc.).

On my Ubuntu system, the jedit wrapper script passes on whatever file I mention on the commandline, and jEdit effectively uses it, so the problem isn't with the jEdit application itself.

Conclusion: it looks like the jEdit.app doesn't take the parameters you give it to pass them on to the java commandline...

As a solution, try to start it as java -jar /path/to/jedit.jar "$@" from your script (AFAIK there is no need for the touch line either).

原来是傀儡 2024-09-22 20:47:38

这对我在 jEdit 5.1.0 上有效:

touch foo
open -a /Applications/jEdit.app foo

This works for me on jEdit 5.1.0:

touch foo
open -a /Applications/jEdit.app foo
始于初秋 2024-09-22 20:47:38

转到实用程序>全局选项>一般

取消选中启动时恢复以前打开的文件(在此之前,我确保选中了“包含在命令行上指定的文件名...”)

我知道,这很奇怪,但这对我有用(mac os x Snow leopard) 、jedit 4.3.2、java 1.6.0_22)

Go to Utilities > Global options > General

Uncheck the Restore previously opened files on startup (before that, i made sure the 'include file names specified on command line...' is checked)

I know, it is strange, but this worked for me (mac os x snow leopard, jedit 4.3.2, java 1.6.0_22)

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