Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » The active editor does not contain a main type
The active editor does not contain a main type [message #191678] Fri, 02 February 2007 19:44 Go to next message
Eclipse UserFriend
Originally posted by: alizamel.hotmail.com

Hello guys,
I am just trying to run the hello world program, quite sure the code is ok.

However, when i try to run using eclipse version 3.1.1 I am getting the
following error:

The active editor does not contain a main type

Can anyone help.

thanks.
Re: The active editor does not contain a main type [message #191686 is a reply to message #191678] Fri, 02 February 2007 19:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: wharley.bea.com

"ALIZ" <alizamel@hotmail.com> wrote in message
news:f1df46508d110a59e7763bd6a115ad95$1@www.eclipse.org...
> Hello guys,
> I am just trying to run the hello world program, quite sure the code is
> ok.
>
> However, when i try to run using eclipse version 3.1.1 I am getting the
> following error:
>
> The active editor does not contain a main type
>
> Can anyone help.

Can you be more specific about what you mean by "try to run" and "am
getting"?

Are you talking about running the program inside an instance of Eclipse, ie
using the "Run As" command? If so, exactly what "Run As" profile are you
using (Eclipse Application, for instance)? Is the error occurring in the
host instance of Eclipse or in the debug target? How is the error being
presented (as a popup, in the log, ...)? When does the error occur (as soon
as you say Run As, or when the target instance appears on screen, or when
you click the new action command on the menu, or... ?
Re: The active editor does not contain a main type [message #191693 is a reply to message #191686] Fri, 02 February 2007 19:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alizamel.hotmail.com

Hi there,
well I have tried to run as follows:

run -> run as -> Java Application

The error occurs directly after that, presented as popup window.

Launc Faild

The active editor does not contain a main type.

Thanks.
Re: The active editor does not contain a main type [message #191699 is a reply to message #191678] Fri, 02 February 2007 20:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse.spfweb.co.uk

On 2/2/07 19:44, in article
f1df46508d110a59e7763bd6a115ad95$1@www.eclipse.org, "ALIZ"
<alizamel@hotmail.com> wrote:

> Hello guys,
> I am just trying to run the hello world program, quite sure the code is ok.

Really?

--
Steve
Re: The active editor does not contain a main type [message #191721 is a reply to message #191693] Fri, 02 February 2007 21:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: wharley.bea.com

"ALIZ" <alizamel@hotmail.com> wrote in message
news:1f842e80690455033891b159d03fc960$1@www.eclipse.org...
> Hi there,
> well I have tried to run as follows:
>
> run -> run as -> Java Application
> The error occurs directly after that, presented as popup window.
>
> Launc Faild
>
> The active editor does not contain a main type.



Which Hello World application are you trying to run? If you're trying to
run a plug-in, you need to run it as an Eclipse Application, rather than as
a Java Application.
Re: The active editor does not contain a main type [message #191759 is a reply to message #191721] Fri, 02 February 2007 22:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alnoor20000.yahoo.co.uk

I do not know what a plug-in is???
I created the new project with the option create project from existing
source.
and then located the directory which was a folder called examples that
contains another folder called windows. (the .class files are also in the
windows folder)

Here is the code I am trying to run:
package examples.windows;

import javax.swing.JFrame;

import javax.swing.JLabel;

import java.awt.BorderLayout;

/** An example of a very simple windowed program

*/

public class HelloWorld extends JFrame {

/** Class constructor

* @param titleText window's title bar text

*/

public HelloWorld( String titleText ) {

super( titleText );

setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );

JLabel greeting = new JLabel( "Hello World!",

JLabel.CENTER );

getContentPane().add( greeting,

BorderLayout.CENTER );

setSize( 300, 100 );

setVisible( true );

}

/** The test method for the class

* @param args not used

*/

public static void main( String[] args ) {

new HelloWorld( "Hello World! Sample" );

}

}

Thanks.

"Walter Harley" <wharley@bea.com> wrote in message
news:eq0a6q$je1$1@utils.eclipse.org...
> "ALIZ" <alizamel@hotmail.com> wrote in message
> news:1f842e80690455033891b159d03fc960$1@www.eclipse.org...
>> Hi there,
>> well I have tried to run as follows:
>>
>> run -> run as -> Java Application
>> The error occurs directly after that, presented as popup window.
>>
>> Launc Faild
>>
>> The active editor does not contain a main type.
>
>
>
> Which Hello World application are you trying to run? If you're trying to
> run a plug-in, you need to run it as an Eclipse Application, rather than
> as a Java Application.
>
Re: The active editor does not contain a main type [message #191775 is a reply to message #191759] Sat, 03 February 2007 00:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: wharley.bea.com

"Jalal" <alnoor20000@yahoo.co.uk> wrote in message
news:eq0cl2$dfn$1@utils.eclipse.org...
>I do not know what a plug-in is???
> I created the new project with the option create project from existing
> source.
> and then located the directory which was a folder called examples that
> contains another folder called windows. (the .class files are also in the
> windows folder)
>
> Here is the code I am trying to run:
> [...]

When I copy your example code into a new Java project, build, and run it, I
am not having any problem.

Are there any entries in your error log? (Window -> Show View -> Error
Log).

Does it work for you if you create a new project in the workspace, rather
than using "create from existing source", and then copy the code into a
newly created source file?
Re: The active editor does not contain a main type [message #191923 is a reply to message #191775] Sat, 03 February 2007 11:23 Go to previous message
Eclipse UserFriend
Originally posted by: alnoor20000.yahoo.co.uk

Yes it does work when I create a new project in the workspace.
Thanks for your help
"Walter Harley" <wharley@bea.com> wrote in message
news:eq0kb1$fa0$1@utils.eclipse.org...
> "Jalal" <alnoor20000@yahoo.co.uk> wrote in message
> news:eq0cl2$dfn$1@utils.eclipse.org...
>>I do not know what a plug-in is???
>> I created the new project with the option create project from existing
>> source.
>> and then located the directory which was a folder called examples that
>> contains another folder called windows. (the .class files are also in
>> the windows folder)
>>
>> Here is the code I am trying to run:
>> [...]
>
> When I copy your example code into a new Java project, build, and run it,
> I am not having any problem.
>
> Are there any entries in your error log? (Window -> Show View -> Error
> Log).
>
> Does it work for you if you create a new project in the workspace, rather
> than using "create from existing source", and then copy the code into a
> newly created source file?
>
Previous Topic:graphical GUI designer?
Next Topic:introductory doc
Goto Forum:
  


Current Time: Fri Apr 26 21:01:39 GMT 2024

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

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

Back to the top