krystah
krystah

Reputation: 3733

Eclim not detecting main-class any more?

Eclim daemon is running.
:PingEclim yields

File: Foo.java

public class Foo {
  public static void main(String[] args) {
    System.out.print("Foo");
  }
}

By running :Java, I am presented with the error

java.lang.RuntimeException: Required setting 'org.eclim.java.run.mainclass' has not been set.

Now, I know I can manually set the mainclass in the project settings, but this used to work just by running :Java. Additionally I can add that running :Java % is not working either. It simply seems incapable of detecting my main function.

Update Included the output of :Java % below.

Error: Could not find or load main class .Foo [java] Java Result: 1

Update 2
It seems Eclim sets the main class the first time it detects and runs a Main function inside a Project. After that, trying to manually run another class containing a main function will result in the above error. Not sure how to work around it, but it should really be possible to not be locked to the class that is run first.

Upvotes: 1

Views: 829

Answers (2)

mikel
mikel

Reputation: 1043

i am having the same problem . i compared two projects one was made by eclim and other in eclipse and found .

.classpath file on :

eclipse

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="output" path="bin"/>
</classpath>

eclim

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="output" path="bin"/>
</classpath>

so i tried to change it to the one like eclipse and it worked .

Upvotes: 0

jer_yin
jer_yin

Reputation: 378

I had the same problem too. Then I found out that if the main class is included in a package, you have to use the full qualified class name. For example, if your main class starts with:

package a.b.c;

Then use the setting:

org.eclim.java.run.mainclass = a.b.c.Foo

After that, it should work fine.

Upvotes: 1

Related Questions