Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 7 of 7

Thread: "Selection does not contain a main type"

  1. #1
    Junior Member
    Join Date
    Feb 2012
    Posts
    4
    My Mood
    Confused
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default "Selection does not contain a main type"

    I'm totally new to eclipse/java programming so not sure what to do.

    http://i39.tinypic.com/fx5usm.jpg

    I tried doing Run as Java Application but I receive that message. Any ideas how to fix it?


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,156
    My Mood
    Hungover
    Thanks
    141
    Thanked 595 Times in 510 Posts

    Default Re: "Selection does not contain a main type"

    If you want help, you should provide an SSCCE that demonstrates the problem. Is this an eclipse problem, or a general problem? What happens when you compile from the command line?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Junior Member
    Join Date
    Feb 2012
    Posts
    4
    My Mood
    Confused
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: "Selection does not contain a main type"

    I'm pretty sure Eclipse isn't the problem.

    http://i39.tinypic.com/kcnla9.jpg

    I asked my instructor about this and he said I didn't compile the file

    http://i39.tinypic.com/kcnla9.jpg

    I showed him that screenshot and he said I need to do "javac Welcome1.java" as you can see it gives me it isn't recognized.

    I'm suppose to get this
    http://i41.tinypic.com/14m70ps.jpg
    Ignore the command prompt in this, I don't receive the "welcome to java programming" message in my command prompt from before.

  4. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,156
    My Mood
    Hungover
    Thanks
    141
    Thanked 595 Times in 510 Posts

    Default Re: "Selection does not contain a main type"

    Please don't post screenshots of your code or error message- just copy and paste them here. Don't forget the highlight tags.

    Did you do as your instructor asked? Did you compile your code? It sounds to me like he's asking you to compile from the command line, if he's asking you to call javac. Did you do that? What happened when you tried?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #5
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,156
    My Mood
    Hungover
    Thanks
    141
    Thanked 595 Times in 510 Posts
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  6. #6
    Junior Member
    Join Date
    Feb 2012
    Posts
    4
    My Mood
    Confused
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: "Selection does not contain a main type"

    Okay I tried reading what you suggested, and it seems my problem is setting my path correctly to set up the use of "javac". Maybe you can help me here, in environment variables, I go to the bottom portion labelled System Variables and create a new profile. I put both the variable name and value the same. What I paste in was my bin folder, just for reference it was C:\Program Files\Java\jdk1.7.0_03\bin

    I then went into command prompt and tried it, still receive that javac isn't working properly.

  7. #7
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,156
    My Mood
    Hungover
    Thanks
    141
    Thanked 595 Times in 510 Posts

    Default Re: "Selection does not contain a main type"

    What is the actual error message? Please copy and paste it here.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Replies: 3
    Last Post: December 7th, 2011, 01:03 AM
  2. Need something like a "Hashtable<String[], Integer>" kind of data type @@
    By Albretch Mueller in forum Java Theory & Questions
    Replies: 2
    Last Post: November 27th, 2010, 09:24 PM
  3. Replies: 6
    Last Post: November 12th, 2010, 03:40 AM
  4. Replies: 2
    Last Post: March 26th, 2010, 11:22 AM
  5. "java.lang.NoSuchMethodError: main" and "fatal exception occured."
    By joachim89 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: January 10th, 2010, 07:35 AM