Browse - Programming Tips - Jetty: how can I add a .jar to my project?

Date: 2018jun29
Platform: Jetty
Language: Java

Q.  Jetty: how can I add a .jar to my project?

A.  You need to make context file.

In $JETTY_HOME/contexts/<my-app>.xml modify extraClassPath

<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd"> <Configure class="org.eclipse.jetty.webapp.WebAppContext"> <Set name="contextPath">/</Set> <Set name="war"><SystemProperty name="jetty.home" default="."/>/webapps/<my-app>.war</Set> <Set name="extraClasspath">c:/example/folder/example1.jar;c:/example/folder/example2.jr</Set> </Configure>
Make sure your context file (<my-app>.xml has the same basename as <my-app>.war)