I never used Java, but I'm looking over a big server project writting in Java with Eclipse.
My question is, how can I find the main() function, is there an easy way, or I have to search for it in every .java file ?
main(): It is a default signature which is predefined in the JVM. It is called by JVM to execute a program line by line and end the execution after completion of this method. We can also overload the main() method. String args[]: The main() method also accepts some data from the user.
From the Eclipse IDE menu, select Search>Java ... . In the dialog, enter: "main" as the search string. "Method" in the "Search For" box.
Go into the project properties by right clicking the project in the solution explorer and click properties. On the first tab you will see a drop down list for the entry point. Select the appropriate main method.
When the Java interpreter executes an application (by being invoked upon the application's controlling class), it starts by calling the class's main method. The main method then calls all the other methods required to run your application.
You will have to do a code base wide search as it could be in any file. Having said that, many server based project do not have a main() function at all. The server provides the infrastructure and only looks for classes which inherit from specific other classes or implement certain interfaces or are mentioned in certain config files. All of this depends on the server and the technologies employed.
You need to find out what your server is, what technologies have been used in the java project and how it was setup.
main(
" in all projects java files (= entire workspace)java
call that starts the application (a parameter is the main class)build.xml
). Eventually they contain some jar, install or deploy target where startup scripts are autogenerated or manifest files are written. The main class should be named there.BTW - If the big server project is a server based application, say the final build result is a war or an ear file, then the entry point doesn't have to be a static main
method. Then it might not even have one single starting point.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With