0

I look at a lot of small Java programs. It would be convenient if I could set up a directory (or directory structure) on my Mac where any time I add a .java file, javac automatically runs and attempts to compile that file. I've briefly looked into Automator actions, but found nothing that fits the bill. Then I got to thinking: on my PC, I would use the .Net FileSystemWatcher class and write the code myself. But before I try that on my Mac with Mono, I want to ask the community for other ideas. Any advice is appreciated. Thanks.

4

2 回答 2

1

如果您在开始时拥有所有可用的 .java 文件,则可以编写一个 shell 脚本以一次运行将它们全部编译——如果需要,可以在不同的目录中。

如果你解释了你为什么想要这个,也许我/我们会更有帮助。

于 2009-11-01T15:16:41.033 回答
1

在 JDK6 中,您可以通过编程方式编译,因此您可以编写自己的程序来执行此操作,这可能比在单声道中执行要好一些。

因此,您将拥有一个始终运行的程序,它会查找任何新文件或自上次检查以来已更改的文件,然后编译它们,您可能希望它将信息传递到仪表板窗口是错误,也许还有一些状态信息,所以你知道它正在工作。

http://binkley.blogspot.com/2005/09/programmatically-compiling-java-in-jdk.html

于 2009-11-01T15:24:14.527 回答