Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not find or load main class org.test #287

Open
wove5 opened this issue Apr 24, 2017 · 3 comments
Open

Could not find or load main class org.test #287

wove5 opened this issue Apr 24, 2017 · 3 comments

Comments

@wove5
Copy link

wove5 commented Apr 24, 2017

Hi there.

I have installed the following on my Fedora 25 workstation:
eclipse in my home directory - after I removed the repository installation with dnf.
eclim using the "Build from Source method", -(the graphical installer did not work for me).
eclim 20170328.1807 form melpa,

Eclim is working for me in both VIM and emacs. I can create projects, build projects, perform auto-complete, run code in VIM only, but cannot run a class in emacs.

I have been trying the my_project example on http://eclim.org/gettingstarted.html
My directory layout for eclim projects is as follows:

[david@localhost my_project]$ pwd
/home/david/projects_eclim/workspace_eclim/my_project
[david@localhost my_project]$ tree
.
├── bin
│   └── org
│   └── test
│   ├── TestMain.class
│   ├── TestMain.java~
│   └── workbench.xmi
└── src
└── java
└── org
└── test
├── TestMain.java
├── TestMain.java~
└── workbench.xmi

The sample java source file TestMain.java suggested by http://eclim.org/gettingstarted.html is:

package org.test;
public class TestMain
{
public static final void main(String[] args)
{
System.out.println("Hello World");
}
}

In emacs when I try M-x eclim-run-class , I get the following error showing in the compilation buffer:

~/eclipse/eclim -command java -p my_project -c org.test.
Error: Could not find or load main class org.test.
[java] Java Result: 1

I am very new to java and programming generally. I have not used package statements before and I do not understand how the package statement at the top of the source code works, but I have found that whatever is placed between "package" and ";" gets applied as an argument to the -c option of the java command.

When I run the same command at the bash shell command line I get the same result
[david@localhost eclim]$ ~/eclipse/eclim -command java -p my_project -c org.test.
Error: Could not find or load main class org.test.
[java] Java Result: 1

However when I change this command by appending the class/source name TestMain at the end, I get:
[david@localhost eclim]$ ~/eclipse/eclim -command java -p my_project -c org.test.TestMain
Hello World

I read on some forums about the project setting called:
org.eclim.java.run.mainclass

For my projects this setting seems to always get set to "none". I tried setting it as:
org.eclim.java.run.mainclass=org.eclim.TestMain

but I still get the same error in emacs. This setting seems to have no effect.

Can anyone can help me with this?
Thank you for your time.
Regards,
David.

@skybert
Copy link

skybert commented Apr 27, 2017

FYI: Development has moved to https://github.com/emacs-eclim/emacs-eclim

@nloyola
Copy link

nloyola commented Apr 28, 2017

Does page Run configurations from the Wiki help with your problem?

@wove5
Copy link
Author

wove5 commented Jan 28, 2018

Yes it does, thank you nloyola; it seems the page has one small typo:
C - c C - e r r should be C - c C - e u r for 'eclim-java-run-run' ?

Thank you skybert for informing me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants