I need to add a -javaagent
argument in my JVM args when running jar1, but reference jar2 that is contained within jar1. I have tried:
-javaagent:BOOT-INF/lib/jetty-alpn-agent-2.0.0.jar"
with no success. How do I determine the location of JARs within a running system at runtime?
(This is to run jetty-alpn-agent-2.0.0.jar
as a Java Agent for HTTP/2 use with Pushy APNs)
@indusBull
The solution that worked for me was to define a property called libDirectory
in my gradle.properties
file, which was the location of where the JARs are located in a running system, and then reference that variable from my Dockerfile
:
gradle.properties
libDirectory = /opt/meanwhileinhell/app/lib
Dockerfile
ENTRYPOINT ["java",\
...
...
"-javaagent:${libDirectory}/jetty-alpn-agent.jar",\
"-jar", "/app.jar"]