Skip to content

Clarifications regarding using JBANG with Tomcat 9 and JAR files #1858

Answered by maxandersen
nimayneb asked this question in Q&A
Discussion options

You must be logged in to vote

I was curious - so as @quintesse says then making custom archives is out of scope for jbang but embedded usecase should work.

Here is what I got working with some StackOverflow and chatgpt help :)

///usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS org.apache.tomcat.embed:tomcat-embed-core:10.1.0
//DEPS org.apache.tomcat.embed:tomcat-embed-jasper:10.1.0
//DEPS javax.servlet:javax.servlet-api:4.0.1

import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;

import org.apache.catalina.Context;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.startup.Tomcat;

import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakar…

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@quintesse
Comment options

@nimayneb
Comment options

Answer selected by nimayneb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants