是否可以从命令行运行 Eclipse JDT 编译器,如 javac?
我想在安装了 Eclipse 的机器上对各个 Java 源文件进行一些命令行 Java 编译。但是,我无权在此计算机上安装完整的 Java SDK。
据我所知,Eclipse 通过其 JDT 进行编译,而不是使用 javac
。
是否可以从命令行使用 Eclipse 编译器?
I'd like to do some command-line Java compiling of individual Java source files on a machine that has Eclipse installed. However, I don't have permissions to install a full Java SDK on this machine.
I understand that Eclipse compiles through its JDT, not using javac
.
Is is possible to use the Eclipse compiler from the command line?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
又搜索了几分钟,我在 Eclipse 文档,在“运行批处理编译器”部分下:
或者:
我还在 如何从命令行构建整个 Eclipse 项目,其中包含一些相同的信息,但由于没有显示在我最初的搜索中,我将这个问题悬而未决。
(在我要单击“发布您的答案”之前大约 2 秒,Jon Skeet 的回复弹出了。)
对我有用的确切语法(Sun JRE 在 Windows PATH 中,Eclipse 版本是Galileo build 20100218-1602):
我省略了
-classpath rt.jar
并且它仍然有效。在此版本中找不到“ecj.jar”文件。似乎此操作的具体说明确实因版本而异,因此请注意编码员。
A few more minutes of searching and I found this in the Eclipse documentation, under the section "Running the Batch Compiler":
or:
I also found this Q/A on how to build an entire Eclipse project from the command line, which contains some of the same information, but since it didn't show up in my initial search I'm leaving this question open.
(And about 2 sec before I was going to click "Post Your Answer", Jon Skeet's reply popped up.)
The exact syntax that worked for me (Sun JRE is in the Windows PATH, Eclipse version is Galileo build 20100218-1602):
I omitted the
-classpath rt.jar
and it still worked. Couldn't find the 'ecj.jar' file in this build.It seems that the specific instructions for this do change from release to release, so caveat coder.