I use Eclipse 3.0 and have never seen this particular error. Are you able to run the class from command line outside of eclipse?
Or maybe the file thats in focus (unintentionally) has no main function, and that's why it's complaining.
I usually find it helpful to set up the debug configurations for whatever code I need to run. I believe the 'main type' they're referring to is what you list as your 'Main class' in the debug configuration definition.
Yup - you must be trying to run a class as an application which has no main method (please Tom - functions belong in VB). Out of curiousity I just tried to run the interface I'm currently writing via Eclipse in the same way and thats the exact error I see.
I'm looking for solutions to the same problem, and can't find very much at all. I've been using Eclipse 3.0.0 for several months with Java 1.4.2 and Jigloo 2.7.2. I've never had problems creating an SWT Main Application before, but attempts today have been failing with this "active editor does not contain a main type" message when I try to run a newly created application. Worth noting that existing apps in the same project run ok.
Scouring the internet did bring up a reference to a bug showing the same symptoms in Eclipse 2.1, but supposedly this is now fixed.
In desparation, I'm arranging to restore my project from a backup taken last night.
Has anyone got any more ideas?
Joined: Jan 11, 2005
Just an update... the restore of my workspace didn't solve the problem.
Joined: Jan 11, 2005
I'm extremely embarrassed to say that I've found the problem. I'd forgotten to put in the VM Arguments. Just in case it is of use to others, the details are as follows. Select run... , and then the VM Arguments tab and enter the appropriate path with -Djava.library.path=blahblahblah.
When I tried to run the above vlas from eclipse I got an error "editor does not contain main type". But when copy the class to another package it works fine. Any clues?
THe main point is I am trying to run some demo applications. All libraries and jar files are there in my systesm and path and classpath variable are correct. But when I am tryign to run a class which have main,, it gives the same error. So that I created a test class (above class) and tried to run. When that class in the package demos.texture it gives error. But when the test class copied to another package it works fine. Any one can help?
Paul McDonnell wrote:I'm extremely embarrassed to say that I've found the problem. I'd forgotten to put in the VM Arguments. Just in case it is of use to others, the details are as follows. Select run... , and then the VM Arguments tab and enter the appropriate path with -Djava.library.path=blahblahblah.
I'm having the same problem on Eclipse 3.3.2, and, the main procedure exists. Sorry, I'm new to java, do you have more specific information on what you did to resolve this issue?
I had this error and noticed my main class was not under the default directory. I tried to move the class under default and it disappeared. I then ran restore from local history and it showed up under src again, but not under default.
I created a new project and moved all the classes under its default directory. It is working there.
The problem is that class file is not automatically generated by eclipse.. since it is not there in .classpath file. To resolve it either edit .classpath file manually or add the source dir in you project build path, you can do it by right click on project, click on project properties, then a window appears. in left pane there is build path click on it and configure properly
For this it sounds like your source isn't set up properly. If you look at the little icon for your class, do you see a "J" (for Java class) beside the class name as having a blue outline? If it's a "J" with a blue outline as opposed to a solid blue "J" (where it's all blue, not just the outline) then it means Eclipse isn't finding your source, even though it should!!
To fix this right click on your class, Choose Build Path -> Configure Build Path and choose the Source tab. Make sure that there is something in here as it tells Eclipse where to find your source (as I understand Eclipse) and that the folder points to your source file. Sometimes it just stays at <root package>/src even though it should change to where you've put your class e.g. <root package>/Implementation/Pages. You would therefore need to remove this <root package>/src folder and click 'Add folder' and choose <root package>/Implementation/Pages.
I don't know whether this is a Java necessity or an Eclipse one but it causes many problems!
Before you criticize someone, try walking a mile in their shoes. That way you'll be a mile away from them. And you'll also have their shoes.