I have looked everywhere on the internet and tried everything the forums say to do and nothing works.
This error keeps coming up. I have tried running my java project (not for android) even the drop down run as button doesn’t work because it says «none applicable».
Jon Clements
138k33 gold badges244 silver badges278 bronze badges
asked Sep 15, 2014 at 23:24
10
Eclipse needs to see a main method in one of your project’s source files in order to determine what kind of project it is so that it can offer the proper run options:
public static void main(String[] args)
Without that method signature (or with a malformed version of that method signature), the Run As menu item will not present any run options.
answered Sep 15, 2014 at 23:54
MarsAtomicMarsAtomic
10.4k5 gold badges35 silver badges56 bronze badges
1
Check, you might have written this statement wrong.
public static void main(String Args[])
I have also just started java and was facing the same error and it was occuring as i didn’t put []
after args.
so check ur statment.
ncica
6,9971 gold badge15 silver badges37 bronze badges
answered Aug 31, 2015 at 17:17
0
Click on the drop down next to the Run button, After that choose Run Configuration, shows three option, for example i choose java application add class(Name of the class of your project) in that then Click on the ok button …Run your application
Neeraj
answered Jun 23, 2015 at 12:32
When you create a new class file, try to mark the check box near
public static void main(String[] args) {
this will help you to fix the problem.
Leon Adler
2,9251 gold badge29 silver badges42 bronze badges
answered Jan 10, 2016 at 18:39
Emre TuranEmre Turan
511 silver badge1 bronze badge
0
click on the project that you want to run on the left side in package explorer and then click the Run button.
answered Mar 4, 2016 at 2:17
1
Make sure the «m» in main() is lowercase this would also cause java not to see your main method, I’ve done that several times unfortunately.
answered Jul 29, 2015 at 19:02
FRANKFRANK
211 bronze badge
It happens when sometimes we copy or import the project from somewhere. The source folder is a big thing to concern about.
One simple technique is, create a new project, inside the source folder, create a new class and paste the content over there.
It will work…
Hope it helps.
answered Nov 18, 2015 at 6:05
NishNish
6851 gold badge7 silver badges14 bronze badges
Have you checked if:
- You created a
class
file undersrc
folder in your JAVA project?(notfile
) - Did you name your class as the same name of your class file?
I am a newbie who try to run a helloworld example and just got the same error as yours, and these work for me.
answered Sep 2, 2018 at 19:21
0
Check if the filename is same as the classname used by your program.
eg.:
class Dfs{ psvm(String[] args){}}
filename should be Dfs.java
ncica
6,9971 gold badge15 silver badges37 bronze badges
answered Feb 17, 2018 at 14:30
XciAXciA
3382 silver badges10 bronze badges
Check there might be build error in problem message view.
answered Apr 2 at 7:11
yu yang Jianyu yang Jian
6,6127 gold badges55 silver badges79 bronze badges
I am trying to open an unzipped Android Project using Eclipse but every time I try to run or debug it show this error: «selection cannot be launched and there are no recent launches».
So I looked it up and tried creating a new project from an existing source but opens with errors and I open the src etc folders. I also tried importing the project which didn’t work either. There are no run as options and changing the run configuration didn’t really help. I couldn’t find any option to open it as an Android project.
Could you please help me to run this project.
(Since I unzipped this project there is a _MACOSX folder when I import and I am not sure if that matters or should I remove that folder.)
asked Feb 11, 2012 at 12:49
I am running Eclipse Juno SR 2
I had a similar problem. To fix the issue go to Run-> Run Configurations…
- If there isn’t create a new run configuration (top left)
- Under Android tab: browse and select the project you want to run
- Under Target tab: select Always prompt to pick device (or) you can pick automatic launch.
Similar solution can be applied to the Debug by going to Run-> Debug Configurations…
Update:
I realize this is beyond the scope of the question but if any new developers are coming to answer then I would suggest switching to Android Studio from Eclipse. AS is the official Google supported IDE for Android development and much nicer to use.
answered May 10, 2013 at 7:54
toidiutoidiu
9652 gold badges12 silver badges25 bronze badges
3
In the Package Explorer (the left column), right-click on the name of the project (the top item). In the menu that appears, select «Run as»; then choose «Android Application».
answered May 6, 2014 at 7:05
I fixed it for Version: Luna SR2 (4.4.2)
- select run configurations from right side dropdown of run button.
- double click on android application.
- get changing window, select your project name by browsing button of «android» tap(there are 3 tabs).
- from «target» tab select ADT or your device, in which you want to run.
- then press «run» at right -bottom button, left-side of «cancel».
- after few moment, you will get new windows. from there you can select your connected device or ADT.
answered Oct 27, 2015 at 14:55
reza.cse08reza.cse08
5,91047 silver badges39 bronze badges
Generally this error comes in eclipse IDE when you don’t have a main() function in your code.
Check whether your program has public static void main(String [] args) in it or not.
answered Sep 4, 2015 at 19:42
I’m using a mac and this answer is for Kotlin
inside Eclipse
I installed Kotlin
from Eclipse MarketPlace, clicked the perspective tab , opened Kotlin, created a new Kotlin project named
FirstProject
and then clicked src
and created a Kotlin file named FirstFile
(it had the .kt
extension) and typed in
func main(args : Array<String>) {
println("Helooooooo")
}
I pressed the green Run button but kept getting this screen.
To fix it, follow these steps:
- Right next to that green run button is a drop down arrow, press it then choose
Run Configurations
- On the left side of the accompanying screen click
Kotlin Script Launch Configuration
and in the drop down clickNew_configuration
then selectRun
- After the screen disappeared when I pressed the Run button again I got the same exact «This selection cannot be launched …» screen. I deleted the project
FirstProject
and created another oneSecondProject
> src > Kotlin file > named itSecondFile
, typed in theprintln("Heloooooooo")
code and a screen popped up
- I choose
OK
and the project ran fine.
For steps 1 & 2 I also did the same thing and choose Gradle (you can see it the picture) but I don’t think that made any difference.
answered May 22, 2019 at 17:27
Lance SamariaLance Samaria
17.1k16 gold badges103 silver badges251 bronze badges

This tutorial demonstrates the Eclipse error The selection cannot be launched, and there are no recent launches
in Java.
Eclipse The selection cannot be launched
Error
When using Eclipse, an error The selection cannot be launched
can occur. While we have a selection of classes and no class has the main
method, this error will occur in Eclipse because Eclipse will only run the set of classes or an application when it finds the main
class.
Eclipse needs to see the main
method in one of the project files. Otherwise, it cannot run the application.
The main
method should be properly defined as below.
public static void main(String[] args)
Without a proper definition of the main
method, Eclipse will throw the The selection cannot be launched
. Here is an example.
package delftstack;
public class Example {
public static void main(String[] args[]) throws IOException {
System.out.println("This is Delftstack.com");
}
}
The code above will throw The selection cannot be launched
because the main
method is not properly defined. Here is the correct version of the code.
package delftstack;
public class Example {
public static void main(String[] args) throws IOException {
System.out.println("This is Delftstack.com");
}
}
The []
is given to the String
keyword in the main
method statement. Now, this code will work properly.
See output:
Я только что начал программирование на Android, поэтому загрузил Eclipse и начал работу.
Создал мой первый проект после учебника отсюда: http://developer.android.com/training/basics/firstapp/creating-project.html#CommandLine
И когда я был на следующем уроке для запуска этого приложения отсюда: http://developer.android.com/training/basics/firstapp/running-app.html
Я сделал, как они сказали. Подключено мое устройство через USB, включена также отладка USB, но когда я нажал кнопку «Запуск на eclipse», вы получили указанную выше ошибку.
Что я сделал неправильно?
Ответ 1
Eclipse не может решить, что вы хотите запустить, и поскольку вы ничего не запускали раньше, он не может попробовать повторить запуск этого.
Вместо того, чтобы щелкнуть зеленую кнопку «запустить», щелкните раскрывающийся список рядом с ним и выберите «Запустить конфигурации». На вкладке Android убедитесь, что он установлен в вашем проекте. На вкладке «Цель» установите галочку и параметры, соответствующие целевому устройству. Затем нажмите «Выполнить». Следите за вкладкой «Консоль» в Eclipse — это позволит вам узнать, что происходит. После того, как вы установили свой набор настроек запуска, вы можете просто нажать зеленую кнопку «запустить» в следующий раз.
Иногда получить все, чтобы поговорить с вашим устройством, может быть проблематичным для начала. Рассмотрите возможность использования AVD (т.е. Эмулятора) в качестве альтернативы, по крайней мере, для начала, если у вас есть проблемы. Вы можете легко создать его в меню Window → Android Virtual Device Manager в Eclipse.
Чтобы просмотреть ход выполнения вашего проекта, который был установлен и запущен на вашем устройстве, проверьте консоль.
Это панель внутри Eclipse с вкладками «Проблемы/Javadoc/Декларация/Консоль/LogCat» и т.д. Она может быть сведена к минимуму — проверьте лоток в правом нижнем углу. Или просто используйте Window/Show View/Console в меню, чтобы оно стало на первый план. Есть две консоли, Android и DDMS — есть выпадающий список, где вы можете переключаться.
Ответ 2
Выполните следующие действия, чтобы запустить приложение на подключенном устройстве.
1. Измените каталоги в корневой части вашего Android-проекта и выполните:
ant debug
2. Убедитесь, что каталог Android SDK platform-tools/
включен в переменную среды PATH
, затем выполните: adb install bin/<*your app name*>-debug.apk
На вашем устройстве найдите <*your app name*>
и откройте его.
Обратитесь Запуск приложения
Solution 1
Eclipse needs to see a main method in one of your project’s source files in order to determine what kind of project it is so that it can offer the proper run options:
public static void main(String[] args)
Without that method signature (or with a malformed version of that method signature), the Run As menu item will not present any run options.
Solution 2
Check, you might have written this statement wrong.
public static void main(String Args[])
I have also just started java and was facing the same error and it was occuring as i didn’t put []
after args.
so check ur statment.
Solution 3
Click on the drop down next to the Run button, After that choose Run Configuration, shows three option, for example i choose java application add class(Name of the class of your project) in that then Click on the ok button …Run your application
Neeraj
Solution 4
When you create a new class file, try to mark the check box near
public static void main(String[] args) {
this will help you to fix the problem.
Solution 5
click on the project that you want to run on the left side in package explorer and then click the Run button.
Comments
-
I have looked everywhere on the internet and tried everything the forums say to do and nothing works.
This error keeps coming up. I have tried running my java project (not for android) even the drop down run as button doesn’t work because it says «none applicable».