• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 370
  • Last Modified:

Cannot Run a Java application on Eclipse

Hi,

If any of you have used eclipse, please let me know what this error means.
I am running an open source code - dtdparser
I tried to run it in eclipse and it compiles fine but at runtime gives the following error in a dialog box:
The active editor doe snot contain a Main type

When I checked the file ClassGenerator.java

It has the main method.

Any thoughts?

Oh and By the way after I build it, its not showing me the class file.
Does it store it in a separate bin directory or something?

Please lemme know
0
dkamdar
Asked:
dkamdar
1 Solution
 
RMaruszewskiCommented:
> Oh and By the way after I build it, its not showing me the class file.
> Does it store it in a separate bin directory or something?

It depends how you configure your project. You can set the "bin" directory, it's the common practice.
But by default the compiled files (.class) are created in the same directories where source files (.java) are located.
0
 
fifaloverCommented:
Open the properties for your project. Go into the Java Build Path and in there you can specify the folders in your project to compile (that's what is in the "Source folders on build path") and the output for all the class files ("Default output folder"). If you've put your code into folders in your project that aren't part of the package name, make sure they are listed as a source folder. If you need to have any JAR files in your classpath when compiling, switch to the Libraries tab and add them there.

For example, I'm working on something I've checked out from a CVS repository. It has more than just the source code in there, so the source code is in the /implementation/source folder. Then beneath that are the folders that correspond to the package names. For Eclipse to compile this project I had to change the source folder it was compiling. It was trying to compile from the root directory, which didn't work since the package names didn't start with implementation.source. Once I did that it compiled just fine and I changed the output path to /implementation/build to tell it where to put the class files.

As long as that all checks out, just make sure that main method is static. I've goofed on that before myself when I was in a rush to write something.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now