Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find main method of dynamic web project in eclipse?

Tags:

java

eclipse

I have created a dynamic web project in eclipse. Now I have a situation in which I need to start a thread while application gets started[Short of in main method]. Now I searched the whole project for the class containing the main method. But I didn't get it.

Like in web.xml

<welcome-file-list>
 <welcome-file>index.jsp</welcome-file>
</welcome-file-list> 

Now I want to execute some code before index.jsp gets loaded.. Thanks in advance...

like image 712
Ankit Patel Avatar asked Dec 25 '22 06:12

Ankit Patel


1 Answers

In general web applications are started from the application container and thus do not need to have a main method.

You may want to add a context listner so that you get notifyed about the start of the web application and where you can start your thread.

Here you can find an example.

like image 151
A4L Avatar answered Dec 28 '22 08:12

A4L