FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora Development Java

 
 
LinkBack Thread Tools
 
Old 12-04-2007, 09:07 PM
Jeff Johnston
 
Default Eclipse error when doing a "Run As" in a java project

Timothy Selivanow wrote:

On Tue, 2007-12-04 at 16:51 -0500, Jeff Johnston wrote:

Timothy,

It appears you do not have a proper main method. You should have the
following method in your HelloWorld.java file:


public static void main(String[] args) {
System.out.println("Hello World!");
}

You would have gotten this when you created your New Class if you asked
it to create your main method (there is a click box).


If you right-click on the java file, you will be offered the option to
run it as a Java Application. If you rename it to main2, for example,
you will instead see "Open Run Dialog" offered. If you try and force
this to be run via the dialog, you will get the error message you are
seeing which is entirely expected.


-- Jeff J.



I had the method defined, but I had removed "String[] args" thinking
that I didn't need to pass anything to it so I should take it out. Does
this mean that main() needs at least that argument declaration to work
properly?



Yes. It is looking for that particular main signature. If you rename
it don't make it public or static, all of these will cause the same problem.


-- Jeff J.



--Tim
__________________________________________________ ______________________
/ If you float on instinct alone, how can you calculate the buoyancy for

| the computed load? |
-- Christopher Hodder-Williams /
------------------------------------------------------------------------



/
( )
.( o ).

--
fedora-devel-java-list mailing list
fedora-devel-java-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-java-list


--
fedora-devel-java-list mailing list
fedora-devel-java-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-java-list
 

Thread Tools




All times are GMT. The time now is 01:39 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org