Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fastest way to deploy and run a Java WAR file?

Is there a simple, programmatic way to quickly "deploy" and run a standard Java WAR file for local testing without having to install and configure external software packages like Tomcat or Jetty? Ideally something like Jetty's embeddable features but specifically for WAR files.

Java 6 provides the convenient Endpoint class which makes it easy to quickly deploy and test web services, is there something similar for WAR files? For example:

AppServer as = new javax.iwish.AppServer("localhost", 8080);
as.deploy("/", new File("path/to/my.war");
as.start();
like image 277
maerics Avatar asked Mar 23 '26 20:03

maerics


1 Answers

I asked too soon, it looks like Jetty does exactly what I need:

Server server = new Server(8080);
server.setHandler(new WebAppContext("foo.war", "/"));
server.start();

Remarkably close to my dreamed up API =D

like image 182
maerics Avatar answered Mar 25 '26 09:03

maerics



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!