File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Editor does not contain a main type Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Editor does not contain a main type" Watch "Editor does not contain a main type" New topic

Editor does not contain a main type

Steve De Costa
Ranch Hand

Joined: Jun 04, 2007
Posts: 33
I know this question has been answered before but I tried applying those methods and it didn't work for me. I have one Project and I tried importing the Jgrapht Library in it. When I try to compile any of the files in the imported packages, I get the "Editor Does not contain a main type".

I have no idea how to fix it. In the "default.src" package of my project, I tried to include import the package such as

However, it doesn't recognize the files are there? Any suggesstions please?

Thanks in advance for your help.

[Thumbnail for MainMissing.JPG]

Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

Do you have a main method in there ? If yes, make sure it's well declared (public static void main(String[] args))

[My Blog]
All roads lead to JavaRanch
Vishal Kashyap
Ranch Hand

Joined: Aug 07, 2010
Posts: 73

I think,
please try to install JDK again and the work for your program, if your program contains main method then it should not rise ERROR like this.

MCSA 2003 | Preparing For OCPJP/SCJP6
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46375
Beware: screenshots can be difficult to read.

If you have downloaded a library, you would not expect it to be executable, so there will be no class with a main() method.

Which IDE are you using? It looks like Eclipse to me. There is no need to instruct Eclipse to compile anything; you are probably clicking a "run" button. Find a class with a main method which you can do by going through the javadoc pages; those classes with "Demo" in their name would probably do. Right-click that class in the package explorer, and then "run as" . . . "Java application".
I agree. Here's the link:
subject: Editor does not contain a main type
It's not a secret anymore!