Eclim - 将 org.eclim.java.run.mainclass 设置为什么?
我无法让 :Java 命令在 eclim 中工作。当我运行它时,我得到:
java.lang.RuntimeException: Required setting 'org.eclim.java.run.mainclass' has not been set.
at org.eclim.plugin.jdt.command.src.JavaCommand.execute(JavaCommand.java:107)
at org.eclim.command.Main.main(Main.java:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.martiansoftware.nailgun.NGSession.run(NGSession.java:334)
似乎有很多关于如何解决此问题的解释,例如 这篇帖子在SO或这里,但他们都说通过 :ProjectSettings“设置项目的 org.eclim.java.run.mainclass 属性”。我的问题是我该如何设置它?无论我尝试编写更改时输入什么内容,vim 都会显示“操作包含错误。有关详细信息,请参阅位置列表。”
I'm having trouble getting the :Java command to work in eclim. When I run it I get:
java.lang.RuntimeException: Required setting 'org.eclim.java.run.mainclass' has not been set.
at org.eclim.plugin.jdt.command.src.JavaCommand.execute(JavaCommand.java:107)
at org.eclim.command.Main.main(Main.java:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.martiansoftware.nailgun.NGSession.run(NGSession.java:334)
There seems to be a lot of explainations as how to fix this, such as this post on SO or here, but they all say to "setting the org.eclim.java.run.mainclass property of your project" through :ProjectSettings. My question is what do I set it to? No matter what I put when I try to write the changes vim says "Operation contained errors. See location list for details."
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
当我从 Google 来到这里时,我将发布一个答案:
您需要使用
main
方法设置类的名称。例如,如果您只有一个类:保存文件,请运行
:ProjectSettings
命令,该命令将打开提到的文件并设置:不要忘记也保存该文件。现在您应该正常运行
:Java
As I landed here from Google, I will post an answer:
You need to set the name of the class with
main
method. So for example, if you have just one class:Save the file, run
:ProjectSettings
command which will open the mentioned file and set:Don't forget to save that one too. Now you should normally run
:Java
@Ernest 的答案对于运行项目的主类是正确的。 ,如果您想运行任意类的 main 方法,您只需将当前文件标记
%
作为参数传递给:Java
命令...但是 命令模式传递当前文件标记(%)。
@Ernest's answer is correct to run the main class for a project. However, if you want to run the main method for an arbitrary class you only need to pass the current file token
%
as an argument to the:Java
command...In command mode pass the current file token (%).
虽然我有一个条目“”在.classpath中,但似乎还需要再次运行 :NewSrcEntry src 来触发 eclim 刷新相关配置。
though I have an entry "<classpathentry kind="src" path="src"/>" in .classpath, but it seems that you also need to run :NewSrcEntry src again to trigger eclim to refresh relative configuration.