Friends.Season.3.Complete.720p.BRrip.Sujaidr..pimprg.l !NEW!

Friends.Season.3.Complete.720p.BRrip.Sujaidr..pimprg.l !NEW!

LINK —>>>


Friends Séason 3 Complete 720p BRrip Sujaidr. Duration: 4.7. friends complete series 780p, friends complete series 1080p, friends complete series 720p, friends complete series 720p.Q:

It is possible to have a servlet or an EJB as the main class of a jar?

I’m wondering if it’s possible to start a servlet inside a jar, for example:
java -jar /home/

And after the jar is launched, do something like:
new servlet()

Is this possible?


Yes. It is possible. You can create a class with a public static void main method which can be used in the same way as normal Java main method.
Here is some sample code:

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Main {
public static void main(String[] args) throws IOException, ServletException {
HttpServlet requestServlet = new HttpServlet();
requestServlet.doGet(requestServlet.getRequest(), requestServlet.getResponse());

The HttpServlet class belongs to the java.servlet package and can be used to write servlets.
I assume that the class can be used to write any servlet for which an EJB is not possible to use.
If you have multiple classes inside your JAR file with a public static void main, then you can directly call the main in the main class as described above. If the classes are contained within other packages, then you have to name your main class properly and use the fully qualified class name, otherwise you cannot find the main method.

If you want to have a web application inside a jar file, then I would suggest that you write a little web application which has the main class as the class that contains the business logic, and exposes business methods as servlets, e.g. the following source code is a sample of such a servlet:


Join The Discussion

Compare listings

Terms of Service