Skip to main content



      Home
Home » Newcomers » Newcomers » missing main
missing main [message #271846] Tue, 30 June 2009 18:08 Go to next message
Eclipse UserFriend
Originally posted by: kraleigh.sbcglobal.net

I searched the net and couldn't find anything that made sense on
why eclipse throws the error:

editor does not contain a main type

I found one thread that said it had something to do with the
configuration, but I am very new to both Java and eclipse so
that wasn't much help.

So what I have is your standard hello world file with a main
and I trying to run it. So I click on run and I right clicked
run as and the error message pops up

Can anyone advise?
I am working from the book Learning Java by O'Riely trying
to relearn the basics of Java and quite a bit more ...

thanx Kevin
Re: missing main [message #271854 is a reply to message #271846] Wed, 01 July 2009 02:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kraleigh.sbcglobal.net

I did some further searching and found this post with no answer that makes
sense to me...

> In Eclipse doing a Run/RunAs/Java Application on the HelloWorld
> application below produces the following error:
>
> "The active editor does not contain a main type."
>
> What does this error mean ?

Ok, i figured it out.

I have to define a /main/ in the Run configuration.

So how do I define a main in the run configuration?

Thanx
Kevin

"krraleigh" <kraleigh@sbcglobal.net> wrote in message
news:h2e2cc$q2s$1@build.eclipse.org...
>I searched the net and couldn't find anything that made sense on why
>eclipse throws the error:
>
> editor does not contain a main type
>
> I found one thread that said it had something to do with the
> configuration, but I am very new to both Java and eclipse so
> that wasn't much help.
>
> So what I have is your standard hello world file with a main
> and I trying to run it. So I click on run and I right clicked
> run as and the error message pops up
>
> Can anyone advise?
> I am working from the book Learning Java by O'Riely trying
> to relearn the basics of Java and quite a bit more ...
>
> thanx Kevin
Re: missing main [message #271857 is a reply to message #271854] Wed, 01 July 2009 02:44 Go to previous messageGo to next message
Eclipse UserFriend
hi,
pls check the syntax of the main function and also the letter casing, its
case sensitive. Make sure you have the arguments in the main. main should
be a part of the class file that you are trying to run.

Try this link
http://www.truelogic.co.cc/article/hello-world-program.htm#J AVA

You can also try running the program using jdk. The steps are mentioned in
the link and check if its an eclipse problem or syntax problem in your
program.

Happy learning.

Cheers.
Re: missing main [message #271863 is a reply to message #271846] Wed, 01 July 2009 03:38 Go to previous messageGo to next message
Eclipse UserFriend
Most likely your main signature is incorrect.

Try the "Create your first Java program" from this tutorial:
http://www.vogella.de/articles/Eclipse/article.html

This should work.

Best regards, Lars


krraleigh wrote:
> I searched the net and couldn't find anything that made sense on why
> eclipse throws the error:
>
> editor does not contain a main type
>
> I found one thread that said it had something to do with the
> configuration, but I am very new to both Java and eclipse so
> that wasn't much help.
>
> So what I have is your standard hello world file with a main
> and I trying to run it. So I click on run and I right clicked
> run as and the error message pops up
>
> Can anyone advise?
> I am working from the book Learning Java by O'Riely trying
> to relearn the basics of Java and quite a bit more ...
>
> thanx Kevin
Re: missing main [message #512233 is a reply to message #271846] Thu, 04 February 2010 08:20 Go to previous message
Eclipse UserFriend
I have the same problem with Eclipse 3.5.1 on Ubuntu 9.10.

The Hello World example also threw the same error message (sometimes editor, sometimes selection). Following the tutorial I solved the problem by moving my helloWorld.java into a package. I have no clue though why this would solve the problem.

It did not help with a more complex .java, including several packages, classes and methods, which worked on my friends computer.
Previous Topic:Displaying avi?
Next Topic:Why do i get tabs instead of 4 spaces when auto indention takes place on hitting ENTER?
Goto Forum:
  


Current Time: Sat May 10 23:47:39 EDT 2025

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

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

Back to the top