简体   繁体   English

Windows 7/8和OS X上的Java Emacs SmartCompile

[英]Emacs SmartCompile for Java on Windows 7/8 and OS X

I've started using SmartCompile to compile Java programs and run them from within emacs. 我已经开始使用SmartCompile编译Java程序并从emacs中运行它们。 The following line of code is supposed to both compile and run Java programs after they've been compiled successfully. 在成功编译Java程序之后,以下代码应该可以编译和运行Java程序。

(add-to-list 'smart-compile-alist '("\\.java$" . "javac %f" && "java %n"))

However, if I try the following command in Windows and OS X: 但是,如果我在Windows和OS X中尝试以下命令:

(add-to-list 'smart-compile-alist '("\\.java$" . "javac %f" && "java %n"))

It does not run the program after compiling. 编译后不运行程序。

And every time I start up Emacs, I get the invalid read syntax: . in wrong context 每次我启动Emacs时,都会得到invalid read syntax: . in wrong context invalid read syntax: . in wrong context error. invalid read syntax: . in wrong context出错。 I am really not sure what's going on. 我真的不确定发生了什么。

I'm using Emacs 24, not sure that's relevant or not. 我正在使用Emacs 24,不确定是否相关。

As you can probably see I'm a noob at Emacs so I'd really appreciate if anyone could tell me step by step on how to fix this error or point me in the direction where I can find the solution. 正如您可能看到的那样,我是Emacs的新手,如果有人能逐步告诉我如何解决此错误,或者向我指出可以找到解决方案的方向,我将不胜感激。

Fixed it after messing around with the code. 在弄乱代码后修复了它。 It was my own stupidity really. 真的是我自己的愚蠢。 Don't know much Elisp. 对Elisp不太了解。 Maybe I should learn it if I'm going to want to use Emacs's awesome features more often. 如果我想更频繁地使用Emacs的出色功能,也许我应该学习它。

Here's what the code should look like: 代码如下所示:

(add-to-list 'smart-compile-alist '("\\.java$" . "javac %f && java %n"))

This works on both Windows and OS X. 在Windows和OS X上均可使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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