2

I just discovered eclim, I am trying to run Java in my first project with :Java but it could not find the main class.

I create the project with :ProjectCreate test -n java, open a file test/src/test.java and put the following in it

class Test {
    public static void main(String[] args) {
        System.out.println("Hello, this is a test.");
    }
}

save it, and then run :Java and get the error Could not find or load main class main

The .classpath looks like

<?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>
  • Your java file's name is test.java but class name is Test. Remember, Java is case sensitive. You have to rename the file to Test.java and try again. Main Class name and filename should be of samename. After correcting it, It should work. – SibiCoder May 24 '16 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.