简体   繁体   中英

Why doesn't jEdit work with the 'open' Unix command?

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, ie '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?

This works for me on jEdit 5.1.0:

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

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).

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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