I downloaded eclipse-jee-kepler-SR1-linux-gtk-x86_64.tar.gz. This eclipse is built-in with java and also my Lubuntu is 64-bit. Whenever ns compile and also run a simple code in java choose this one below:

public class Sample public revolution void main(String<> args) System.out.println("YOLO"); I always get one Editor does not contain a key type.I put the file in a task folder called Sample. This eclipse have to compile java code because its an principle distribution devoted for java.

You are watching: Eclipse editor does not contain a main type

How deserve to i deal with this error?

Any assist would be lot appreciated.

Here"s my task structure:

*


java eclipse
share
monitor
edited Jul 11 "14 in ~ 7:32
*

Arjan Tijms
36.8k1212 gold badges105105 silver- badges134134 bronze title
request Jun 9 "14 at 9:53
*

ThisGuyThisGuy
67311 yellow badge88 silver badges1717 bronze title
3
add a comment |

15 answers 15


energetic earliest Votes
39
Problem is the your folder is not determined as a resource folder.

Right click on the task folder -> PropertiesChoose "Java build Path"Click on "Sources" tab ~ above topClick on "Add Folder" on the best panelSelect your folders and also apply
share
follow
answer Apr 29 "18 at 13:19
*

RamrajRamraj
1,7601212 silver- badges1616 bronze title
3
include a comment |
13
I suspect the difficulty is the Sample.java have to be in a package within the src folder.

I guess that eclipse will certainly not automatically look external of there.


share
monitor
reply Jun 9 "14 in ~ 10:18
*

phil_20686phil_20686
3,7921919 silver- badges3838 bronze title
1
add a comment |
12
Right click your job > operation As > operation Configuration... > Java application (in left next panel) - dual click on it. That will certainly create new configuration. Click search switch under Main class section and select your main course from it.


re-publishing
monitor
edited Jun 9 "14 at 10:03
reply Jun 9 "14 in ~ 9:57
*

Ninad PingaleNinad Pingale
5,81444 yellow badges2626 silver- badges4646 bronze title
1
add a comment |
12
I just had this specific same problem. This will certainly sound crazy however if someone sees this shot this prior to drastic measures. Delete technique signature:

public revolution void main(String args<>)(Not the body of your main just an approach declaration)

Save your project then re-write the method"s header earlier onto its particular body. Save again and re-run. That functioned for me but if that doesn"t work shot again however clean task right before re-running.

I don"t know exactly how this resolved it but it did. Worth a shot prior to recreating your entirety project right?


re-publishing
monitor
answered Mar 23 "15 in ~ 5:16
ThatOneGuyThatOneGuy
44655 silver- badges1515 bronze title
2
add a comment |
6
First look for the main method is there or not.If that is there, execute restart her eclipse and also right click the web page which having actually main method, go to operation as Java application.


re-superstructure
follow
reply Jun 13 "18 at 19:37
Sudhir GauravSudhir Gaurav
9711 silver badge44 bronze title
add a comment |
2
Make certain you execute Run together > Java Application.

If not you could shot a project > Clean

Some more questions that faces this that could be helpful, to express this


share
follow
edited may 23 "17 at 12:02
Community♦
111 silver- badge
reply Jun 9 "14 at 10:15
CyclopesCyclopes
58933 gold badges66 silver- badges2626 bronze title
include a comment |
1
*

Create a source folder under Java Resources

*


share
follow
reply Feb 10 "15 in ~ 9:41
sarathsarath
64799 silver badges1818 bronze badges
include a comment |
1
For me, classpath entry in .classpath record isn"t pointing to the ideal location. After editing it to solved the issue


share
monitor
edited might 15 "18 in ~ 17:52
answered might 15 "18 at 17:47
Siva SrinivasSiva Srinivas
1133 bronze badges
include a comment |
0
Ideally, the source code paper should walk within the src/default package also if you haven"t noted any parcel name. For some reason, the source paper might be external src folder. Create within the scr folder it will certainly work!


re-superstructure
monitor
edited Aug 1 "17 in ~ 6:09
Manfred Radlwimmer
12.5k1313 gold badges4848 silver badges5656 bronze title
reply Aug 1 "17 in ~ 5:48
Shiyas CholamukhathShiyas Cholamukhath
59144 silver- badges99 bronze badges
add a comment |
0
Right click on Sample.java document and delete it. Now go to paper -> brand-new -> course , get in name of regime (i.e. Hello) , click on finish . It will certainly create paper hello.java. Enter resource code of program and also finallly push ctrl + F11

*

*


re-publishing
follow
edited Oct 6 "17 in ~ 4:55
Stephen Rauch
42k3030 yellow badges8787 silver badges110110 bronze title
answer Oct 6 "17 in ~ 4:37
Pavan YogiPavan Yogi
12011 silver badge66 bronze badges
add a comment |
0
Right click on your project, select brand-new -> source Folder

Enter src as Folder name, climate click finish.

Eclipse will certainly then recognize the src folder as containing Java code, and you must be maybe to set up a run configuration


re-publishing
follow
answered Mar 3 "18 at 21:37
Brendan Cody-KennyBrendan Cody-Kenny
40944 silver- badges1010 bronze title
add a comment |
-1
I had the same issue. I had actually accidentally turned off the .classpath and .project record in my workspace. Luckily it remained in Recycle bin, as shortly as it to be restored, there were no issues.


re-publishing
follow
reply Aug 5 "17 at 21:54
Pradeep ARPradeep AR
1
include a comment |
-1
place your main an approach class in src folder(in Eclipse Environment).


re-superstructure
monitor
edited Apr 17 "18 at 11:52
answer Apr 16 "18 at 9:34
Kranthi kiranKranthi kiran
1944 bronze badges
0
add a comment |
-2
I installed Eclipse and also created a Java project.Created brand-new Java document outside the "src" directory and also tried to operation that.I obtained the exact same error "Editor does no contain a main type".I simply moved the java file into the "src" folder and also could merely run the program.I couldn"t recognize what other answers were questioning to try. It to be so simple.

See more: Sometimes Love Don T Feel Like It Should, Hurts So Good Lyrics


share
follow
answer Dec 28 "17 in ~ 10:34
Piyush AggarwalPiyush Aggarwal
133 bronze badges
include a comment |
-6
Just adjust "String<> args" to "String args<>".


share
monitor
reply Dec 31 "17 at 7:31
Sonu MishraSonu Mishra
2522 bronze badges
0
include a comment |

Not the prize you're looking for? Browse other questions tagged java eclipse or asking your very own question.


The Overflow Blog
Featured top top Meta
Visit chat
Linked
64
Error: choice does not contain a key type
0
"Selection does not contain a main type" what to do
20
Eclipse error: "Editor does no contain a main type"
0
Editor does not contain a main type, even though that does
connected
632
Eclipse/Java code completion not functioning
738
go a "Find in project..." function exist in Eclipse IDE?
24
bash: ./eclipse: cannot execute binary file
1
"Selection does not contain a main Type" - Eclipse operation Error
1612
What walk "Could not discover or load main class" mean?
10
Why go Eclipse Kepler SR1 error with : JAX-RS 2.0 calls for Java 1.7 or more recent
1
Error beginning Eclipse on Ubuntu, JVM terminated leave code=13
5
Apache Commons Compress: opened .tar.gz
6
Eclipse Java EE: Difference in between R and M1 packages
warm Network concerns an ext hot questions
lang-java
stack Overflow
assets
agency
ridge Exchange Network
site style / logo design © 2021 stack Exchange Inc; user contributions license is granted under cc by-sa. Rev2021.9.21.40254


Stack Overflow works best with JavaScript permitted
*

your privacy

By clicking “Accept all cookies”, girlfriend agree ridge Exchange can store cookie on your an equipment and disclose information in accordance with our Cookie Policy.