Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Editor does not contain a main type

 
Steve De Costa
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

MainMissing.JPG
[Thumbnail for MainMissing.JPG]
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have a main method in there ? If yes, make sure it's well declared (public static void main(String[] args))
 
Vishal Kashyap
Ranch Hand
Posts: 73
BSD C++ Fedora
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Campbell Ritchie
Sheriff
Pie
Posts: 50251
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 jgrapht.org 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".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic