Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » "Hello World" Project Lauching Problemshooting (Selection does not contain a main type)
icon6.gif  "Hello World" Project Lauching Problemshooting [message #665855] Sun, 17 April 2011 07:54 Go to next message
PeggyFriend
Messages: 3
Registered: April 2011
Location: Shanghai
Junior Member

I follow the help menu to create a
Quote:
Hello World
project. But when I execute the 3rd step, it prompts "Selection does not contain a main type",
package helloworld;

public class HelloWorld {System.out.println(Messages.getString("HelloWorld.0")) 
}; 


Does anybody know expertly the cause to evoke this problem? Please assist!

Yours,
Peggy
Re: "Hello World" Project Lauching Problemshooting [message #666009 is a reply to message #665855] Mon, 18 April 2011 15:32 Go to previous messageGo to next message
saurav sarkar is currently offline saurav sarkarFriend
Messages: 428
Registered: July 2009
Senior Member
Hi Peggy,

I am not sure the tutorial which you are following.

But this error usually comes if you are running a Java class as a Java application and the class does not contain the public static void main (String args[]) method.

To run any java class as a java application you need to have that method defined somewhere in your class as that is the entry point of the execution.

cheers,
Saurav


Re: "Hello World" Project Lauching Problemshooting [message #666081 is a reply to message #666009] Tue, 19 April 2011 01:53 Go to previous messageGo to next message
PeggyFriend
Messages: 3
Registered: April 2011
Location: Shanghai
Junior Member
Saurav,

Thks for your answer.
Just like you said, Before running this "Hello World!" project, the system prompted a frame with two options: Java applet or Java application. I ran the applet and it was void. Then I ran Java application. It shoots the problem:
Quote:
selection doesn't contain a main type.


(1) To run this project in a correct way, what type of element/function should be added to the system.

(2) where to paste the code:
Quote:
System.out.println("HelloWorld")


BTW, The tutorial I read was the help file attached to "Eclipes Version 1.67"( I dowloaded it from the official site). My PC is Windows 7. So I installed the Java JDK.exe package and SDK .exe package.

Saurav, if you know any resources for building sites, please tell me the way to get them.

P.S. I try to view your blog, but it was unable to be opened up. It's a pity to miss your articles.

Anyway, Thanks a lot for your help. I wish we can exchange the learnings. My email address: zhangmeryl@gmail.com

B.R.
Peggy


Re: "Hello World" Project Lauching Problemshooting [message #666089 is a reply to message #666081] Tue, 19 April 2011 04:10 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 2011.04.18 19:53, Peggy wrote:
> Saurav,
>
> Thks for your answer. Just like you said, Before running this "Hello
> World!" project, the system prompted a frame with two options: Java
> applet or Java application. I ran the applet and it was void. Then I ran
> Java application. It shoots the problem: Quote:
>> selection doesn't contain a main type.
>
>
> (1) To run this project in a correct way, what type of element/function
> should be added to the system.
> (2) where to paste the code: Quote:
>> System.out.println("HelloWorld")
>
>
> BTW, The tutorial I read was the help file attached to "Eclipes Version
> 1.67"( I dowloaded it from the official site). My PC is Windows 7. So I
> installed the Java JDK.exe package and SDK .exe package.
> Saurav, if you know any resources for building sites, please tell me the
> way to get them.
> P.S. I try to view your blog, but it was unable to be opened up. It's a
> pity to miss your articles.
> Anyway, Thanks a lot for your help. I wish we can exchange the
> learnings. My email address: mailto:zhangmeryl@gmail.com
>
> B.R.
> Peggy

Peggy,

A really good site for beginning tutorials is http://www.vogella.de

Your Java class should look something like this:

public class HelloWorld
{
public static void main( String[] args )
{
System.out.println( "Hello world." );
}
}

Yes, you could dig the message out of some resource as your mysterious
sample code seems to suggest, but that would be for advanced credit,
something to get into down the road when your Java legs are more solid
underneath you. (When you're interested, check out
http://www.javahotchocolate.com/resbundle.html)
Re: "Hello World" Project Lauching Problemshooting [message #666903 is a reply to message #666089] Sun, 24 April 2011 05:32 Go to previous message
PeggyFriend
Messages: 3
Registered: April 2011
Location: Shanghai
Junior Member
Hi Russ,

Thanks for your assistance. I tried to add you into my Skype list to connect with you. Embarrassed My Skype username is Peggy. I sent you a hello message a few days ago.
If you feel free to chat on Skype, please approve my request.

Thanks,
Peggy
Previous Topic:Making Search tab compact
Next Topic:Apache log4j samples??
Goto Forum:
  


Current Time: Fri Apr 26 12:38:23 GMT 2024

Powered by FUDForum. Page generated in 0.08844 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top