views:

338

answers:

1

I can't seem to run a simple Hello World program using eclim. I followed the install guide at http://eclim.org/guides/install.html#guides-install and the tutorial at http://eclim.org/gettingstarted.html#gettingstarted, but when I try to run the program (using :Java) 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)

And I don't know how to set whatever it says I didn't set. The program successfully compiles, and I can run it regularly in terminal, I am using Ubuntu 9.10, java jdk 1.6, eclim 1.5.4.

+2  A: 

It looks like eclim doesn't have the property set that identifies your application's main class. According to http://eclim.org/vim/java/java.html you should be able to remedy this by setting the org.eclim.java.run.mainclass property of your project (to the fully-qualified name of your application's main class).

EDIT - responding to comment:

I'm not familiar with eclim, but I would expect that since this is a project property, you would set it once and from that point on it should be persisted along with the project.

On the other hand, if you want to have multiple main classes that could be invoked and switch between them, then of course you'll need to provide some kind of extra config. How would you expect eclim to know which one you meant by just typing :Java? There might be some nice syntactic sugar you can use to register multiple classes and invoke them as "java 1", "java 2" etc. - but at the end of the day you will always need some way of distinguishing between which class you're thinking of running.

Andrzej Doyle
So I have to manually set it everytime? Can I set it so that there are multiple main functions in the project?
hmm, good point... i haven't actually thought it thru when i asked u. thx