Results 1 to 7 of 7
  1. #1
    gabriel is offline Member
    Join Date
    Jul 2007
    Posts
    41
    Rep Power
    0

    Default editor does not contain a main type

    I have this code
    Java Code:
    package default;
    
    public class First{
    	String a;
    	public static void main(String [] args) {
    		a="hello";
    		
    	}
    }
    and when I run it this error appears
    Java Code:
    editor does not contain a main type
    what's the problem?
    can you help me?

  2. #2
    levent Guest

    Default

    That is not a standard Java compiler/interpreter error. Whic IDE/editor are you using?

  3. #3
    cruxblack is offline Senior Member
    Join Date
    Jul 2007
    Posts
    130
    Rep Power
    0

    Default

    Not containing any main?:confused:
    U just wrote a main method there, strange error messages...i thought even though u code using IDE's, the error message it gives would just be similar to the ones given by the cmd
    What IDE were u using there?

  4. #4
    raxith is offline Member
    Join Date
    Jul 2009
    Posts
    1
    Rep Power
    0

    Default

    look at this for solution

    www(dot)coderanch(dot)com/t/419415/IDEs-Version-Control-other-tools/eclipse-active-editor-does-not

    sorry... im not able to post the link since not posted more than 20 replies... replace (dot) with .

  5. #5
    hero is offline Member
    Join Date
    Jul 2009
    Posts
    20
    Rep Power
    0

    Default

    I had this problem too at first with eclipse.
    make sure your class stands in (project name)/src/(package default)

  6. #6
    Gela is offline Member
    Join Date
    Jan 2013
    Posts
    2
    Rep Power
    0

    Default Re: editor does not contain a main type

    I was going through some Google results and I found this page. Although this question is way too old, I answer it for the possible future viewers who seek answer.
    To solve the problem, simply change the constructor header to:

    public static void main(String[] args)

  7. #7
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default Re: editor does not contain a main type

    Quote Originally Posted by Gela View Post
    To solve the problem, simply change the constructor header to:

    public static void main(String[] args)
    Clearly you don't know what a constructor is, and need to go through some tutorials.

    In future, don't post to old long-dead threads, even if you think you have a solution. Let's keep current topics at the top of the forum listings.

    db

    THREAD CLOSED
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Editor for Java
    By peiceonly in forum New To Java
    Replies: 4
    Last Post: 08-13-2008, 09:27 AM
  2. HTML editor
    By blueboy in forum AWT / Swing
    Replies: 0
    Last Post: 01-15-2008, 01:52 PM
  3. Replies: 1
    Last Post: 08-07-2007, 08:10 AM
  4. Replies: 1
    Last Post: 08-06-2007, 10:11 AM
  5. Xml Editor
    By Marty in forum XML
    Replies: 3
    Last Post: 05-11-2007, 10:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •