Embedded containers and standalone Java applications

When you create a Java application, you either choose to deploy within an external servlet container/application container or embed a container into your jar. There are developers who still refuse to use embedded containers, some for fear: feeling that somehow their application is going to crash just because it runs directly from a java -jar command (haha), others, well, I don’t know why someone could not prefer to run their applications using a simple terminal command, but, there are other opinions and other views, this post is not to criticise any of it. :)

I’m going to list some containers and tools that help to develop standalone applications. I'm not going to teach you how to use each one of them, but I will provide some links to help you.



Probably you already have heard of it. Jetty is one of the most used servlet containers, but, some people still don’t know that they are able to use Jetty as an embedded container and use it within their jars. Actually, Jetty has a slogan that says: "Don't deploy your application in Jetty, deploy Jetty in your application.”. Pretty cool, right?

You can discover how to use a Jetty embedded in your application here


Tomcat is consider the most used and the most widely known servlet container. It is developed and maintained by Apache and it is a great lightweight alternative to deploy your applications.
Like Jetty, you can also use Tomcat within your application as an embedded container.

I didn’t find any official doc about running Tomcat embedded, but I could find a lot of other links, like this one and this one. Both explain how to create your java app using it. :)

TomEE (Tomcat + Java EE 6 Web Profile)

This is pretty cool. You can actually use an embedded Tomcat, but with the advantages of the JavaEE. It is kind of outdated because it does not support the JavaEE 7 yet, but, the developers are working hard on it.
You can see how to use your TomEE embedded here.

Undertow (WildFly web container)

This is a very simple web container, but probably is going to meet your needs. ;) It is maintained by JBoss and it is the web server of the WildFly. I really like this one because its configurations are human readable, using a fluent interface and builders to define servlets, handlers and etc.
You can see how to use Undertow in your project looking at this this site.

Tools, frameworks and helpers

SparkJava (Jetty)

SparkJava is a lightweight web framework which embeds a Jetty 9 into your application so you don't need to pack it as a war and deploy it in an external container. SparkJava is a nice alternative to create web applications because of its facilities. It is pretty simple to configure your application and its routes (HTTP routes) using a nice e very documented api.
You can learn how to use SparkJava over here. Have fun! :)


SpringBoot has been the most used tool for standalone applications. Few configurations, no XML, every SpringFramework advantage and a lot (A LOT) of plugins which auto-configure themselves. You can find out about SpringBoot here. There are a lot of nice tutorials and articles showing how to use it over the internet.


I bet there are a lot of other embedded containers and other standalone tool helpers over there, but, I think those above are the most widely used by software engineers. If you want me to add another container here, leave me a message and I'm going to check it out! ;)



Gabriel Francisco

Software Engineer at GFG, 25 years, under graduated in Computer Science and graduated in Service-oriented Software Engineering. Like playing guitar once in a while. Oh, and I'm kind of boring.

São Paulo

comments powered by Disqus