How to run java program using eclim?

I cannot run a simple Hello World program using eclim. I followed the installation guide 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 do not know how to install everything that says that I did not ask. The program compiles successfully, and I can run it regularly in the terminal, I use Ubuntu 9.10, java jdk 1.6, eclim 1.5.4.

+4
source share
2 answers

It seems that eclim does not have a set of properties that identifies your main application class. According to http://eclim.org/vim/java/java.html you should fix this by setting the org.eclim.java.run.mainclass properties of your project (to the fully qualified name of the main class of your application).

EDIT - response to comment:

I am not familiar with eclim, but I would expect that since this is a project property, you should set it once and from now on it should be saved with the project.

On the other hand, if you want to have several main classes that can be called and switch between them, then, of course, you will need to provide some additional configuration. How would you expect eclim to find out what you had in mind by simply typing :Java ? Maybe there is good syntactic sugar that you can use to register several classes and call them like "java 1", "java 2", etc., but at the end of the day you will always need some way to distinguish between re thinking about running.

+5
source

Thought I'd add a more satisfactory answer, as this question rose to the top in a few google searches that I did ...

By calling :Java % , the current file will be executed. See here for more details.

+10
source

Source: https://habr.com/ru/post/897191/


All Articles