Make Sure:
- you are working on the Jave Perspective . There are various prespective in Eclipse.
- when you created your project, have u selected file>new>Java Project.
- right click on you project in project explorer,then choose run configuratin,in the "type filter text" text box type "java application" ,select it and choose prespective link on the right side.
select Java Application in "Application Type/Launchers:" list box. Then select "Java" in "Run" drop down box.
apply>ok
- here you go.
Make Sure:
- you are working on the Jave Perspective . There are various prespective in Eclipse.
- when you created your project, have u selected file>new>Java Project.
- right click on you project in project explorer,then choose run configuratin,in the "type filter text" text box type "java application" ,select it and choose prespective link on the right side.
select Java Application in "Application Type/Launchers:" list box. Then select "Java" in "Run" drop down box.
apply>ok
- here you go.
Do you have main method? Try Run - Run Configurations - Java Application and create new launch configuration.
What pops up when I try to run my SpringBoot project
I honestly have no clue what happened, I was running all the projects from my class . Now it wont allow me to run the project I select to be ran as a SpringBoot project.
I typically just right click my project, go down to run as, then select SpringBoot !
Now whenever I want to do that, it wants me to select another application and I am clueless
The photo I attached is the screen that pops up when I try to run a project
For my projects to run as they did before !
How to run single Java file from a project in Eclipse? - Stack Overflow
While debugging a springboot project , eclipse always asks to "Select Java Application" -- Why? - Stack Overflow
java - How to run Spring Boot web application in Eclipse itself? - Stack Overflow
Run as java application option disabled in eclipse - Stack Overflow
Videos
It's important to note that you can't just run arbitrary Java code, but have to have some structure set up (for example, if you're going to call a method, what arguments are you passing in?) To run a specific piece of Java code, you should consider creating a main method in that class that just launches some specific piece of code under the constraints that you'd like. One way to do this would be to add a method public static void main(String[] args) containing the code you want to run. Once you've done this, you can right-click on it, choose the "Run as..." option, and select "Java application" to run the program you've written.
Alternatively, if you just want to check whether some specific piece of code is working, you could consider using JUnit to write unit tests for it. You could then execute the JUnit test suite from Eclipse to check whether that specific piece of code is functioning correctly. This is what I would suggest doing, as it makes it possible to test the software through every step of the development.
Hope this helps!
Yes - right-click it and choose Run as -> Java application. You just need a main method.
This answer is late, but I was having the same issue. I found something that works.
In eclipse Project Explorer, right click the project name -> select "Run As" -> "Maven Build..."
In the goals, enter spring-boot:run
then click Run button.
I have the STS plug-in (i.e. SpringSource Tool Suite), so on some projects I will get a "Spring Boot App" option under Run As. But, it doesn't always show up for some reason. I use the above workaround for those.
Here is a reference that explains how to run Spring boot apps:
Spring boot tutorial
Just run the main method which is in the class SampleWebJspApplication.
Spring Boot will take care of all the rest (starting the embedded tomcat which will host your sample application).
Had the same problem. I apparently wrote the Main wrong:
Copypublic static void main(String[] args){
I missed the [] and that was the whole problem.
Check and recheck the Main function!
You can try and add a new run configuration: Run -> Run Configurations ... -> Select "Java Appliction" and click "New".
Alternatively use the shortcut: place the cursor in the class, then press Alt + Shift + X to open up a context menu, then press J.