- open the project you want to run class from;
- in main window: run -> open run dialog...(run configurations);
- in the left section open the project type your project belongs to (if it's main function it would be "java application" in your case);
- under this category your should see all the "executable" class names;
your_eclipse_project -> export... -> runnable jar file...
here the top section of the dialog should list down all the classes having
main() method, something like below
your_eclipse_project -> run as... -> java application
will launch a dialog, which lists down all the main types which can be selected and run. this will search through all the jars referenced by your projects too.
if there is a
meta-inf/manifest.mf file, you can search for
main-class in it.
you can use
run -> run configurations (alt + r + n)
run -> debug configurations (alt + r + b)
the problem is that in a jar, you are not limited to one
main() method. there can be several
main()s scattered across different classes, in "production" sources as well as in "test" sources etc.
if you know for sure that the jar built from this project can be launched using
java -jar the.jar, then it means the
meta-inf/manifest.mf has a
main-class entry: you should look in there for the class name.
otherwise, you have to search for methods named
main with a classical find tool... (see @andythomas' answer)
from the eclipse ide menu, select search>java ... .
in the dialog, enter:
- "main" as the search string.
- "method" in the "search for" box.
- "declarations" in the "limit to" box.
this gives you a convenient, hierarchical list in the "search" view linking to all the classes with main() methods.
click on one of these to navigate to the class. then right-click run as or debug as to run.
- How to quickly find the main() in java project using eclipse ?
- How to get the current project path from eclipse using java
- how to check the current workspace of Eclipse and the project on that workspace using java program?
- How to find the class that throws an exception in Java using Eclipse
- Creating a java application with a mainClass using Maven in Eclipse - 'Could not find the main class'
- How to create the pom.xml for a Java project with Eclipse
- How can I use the java Eclipse Abstract Syntax Tree in a project outside Eclipse? (ie not an eclipse plugin)
- Kotlin And Java In The Same Project Using Eclipse IDE
- How to quickly determine the entry point to a large java project
- How to find project dependencies in eclipse? how eclipse builds the class path?
- Cannot find the main class after converting java project to maven
- How to debug a plugin in Eclipse - i.e. a Java project without a Main method
- How to make a Java project the default in Eclipse
- How to avoid no main class and no class def found error using DropBox and Eclipse for Java
- How do I organize my Java Eclipse project so that the user then only needs to do one import?
- How can I find the version of the Eclipse Java compiler (JDT)?
- How to include the jars referenced in "Java Build Path" section of an Eclipse project in a jar file generated with Ant using a build.xml file
- How to find the caller method when debugging using Eclipse
- Is it possible to load an eclipse Java project using JDT in the headless mode?
- How to find an anonymous class or a local type using the JDT Java Search Engine?
- How to copy my Java Eclipse project to desktop, and then run with the command line?
- How to add referenced library JAR files using relative path for eclipse Java project in vscode
- How do you change the label text in java using eclipse and scene builder?
- How can I create a project in the Git repository root using Eclipse EGit?
- how to run eclipse by using a specified java path directory in eclipse not by the default Java path
- get all the classes with main method in Eclipse Java project
- How to find the methods in Java API in Eclipse
- How do I make use of the apple extensions for Java using Eclipse
- How to find declaration of string resource in Android project using Eclipse ADT
- eclipse juno, how can I associate currently opened files with a project or am I using eclipse outside the box?
More Query from same tag
- GoogleAppEngine Error 403
- Eclipse export .jar file won't run
- Eclipse and JSP typing speed
- Flash builder doesn't create swf file in custom output folder
- How does one set up JavaDoc DocCheck as an Eclipse plugin?
- Creating an application bundle on OSX with eclipse C++
- Trouble making a GUI. Labels, spinners and buttons not appearing
- How to _use_ a javadoc
- JSONWithPadding - CORS related error 500 issue for JERSEY JAX-RS REST
- Running JUnit test in eclipse throws SecurityException
- Eclipse: Nothing to build for file
- Eclipse polymorphism using C++11 shared_ptr error
- Android running really slow in debug mode
- Error reading from an IP-Camera
- Android Eclipse v.20 not generating R.java
- Eclipse, adb, and ddms not detecting Android Emulator
- JavaFX controls module not found, even though I included it in the build path (eclipse IDE)
- Using Git in eclipse ( Oxygen 2 version )
- Integer types not allowed (at 'showAsAction' with value '0x0')
- Can I develop Java servlet using eclipse ADT
- Eclipse Installation Errors
- Recreate specific device screen size in eclipse
- How to disconnect your phone safely when you connect it for debugging through Eclipse?
- How to install .apk files through eclipse when i run the project
- Selenium code example not working
- Git project in eclipse disappeared from workspace after a pull
- I have build errors with m2eclipse but not with maven2 on the command line - is my m2eclipse misconfigured?
- How to find the entry point in a java web application to debug?
- When trying to run program on eclipse it crashes
- Building Android project with Gradle failed