I'm having trouble running a project in Eclipse 4.2. I have a Java program with one class titled Conversion. Eclipse builds the project fine. I'm able to run the program from the command line by navigating to /bin/ in the project's folder that's in the workspace and typing java Conversion
.
However, when I try to run the program from Eclipse, I am shown Error: Could not find or load main class Conversion
in the console.
The project name is 10.12.12: Project
.
It appears that the project is not part of the classpath.
Check in your Run Configuration->Classpath
and if your project is not there, then add it under User Entries
.
I understand the ':' was likely the case here, but I had a tangential issue that might help someone else.
I inherited a project and was having a similar issue. Dev/Debugging is on Mac/Win, and the TST/UAT/PRD environment is RHEL. Someone literally copied the systemd command line and left a '\' in the Debug arguments. The reason this was hard to find is that the lines wrap right at the -D, so the \ is the last char on a line, which looks OK under Linux. I fixed it like this...
In my case it was...
-Dlog4j.configurationFile=file:<PATH>/log4j2.xml \
-DCONFIG_PATH=...
Right-Click Project -> Run-As/Debug-As, click the Arguments Tab.
In the VM Arguments, look for \.
HTH.
Eclipse does not support the use of a colon or hyphen in project names. Colons appear to break the way it handles compilation.
The issue can be fixed by not using a colon in the project's name.
As noted in the comments, this may be a fault of Java 6. It is fixed in Java 7.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With