In Tomcat I want to use a jar inside a web application. The jar file will exist outside of the Tomcat directory.
To include the jar file in tomcat classpath, I modi
I find myself copying extra JARs, which should be available for all contexts and should therefor go into the root loader, into the following directory:
C:\Program Files\Apache Software Foundation\Tomcat 9.0\lib
But this only possible if you have access to this directory, which might not be the case for all ISPs. At least you can do it at home.
Bye
I was using IntelliJ and I tried everything like:
mysql-connector.jar
. Didn't work. (The only thing that worked was that code completion inside IntelliJ was working fine.mysql-connector.jar
to apache-home/lib/ folder. Didn't work.mysql-connector.jar
from Maven inside IntelliJ. Just didn't work.The thing that worked for me:
Include the mysql-connector.jar
file in the PROJECT/web/WEB-INF/lib
folder.
No need to add it as a dependency anywhere. Just compile this and it will work fine.
I figured myself how to add the classpath for tomcat. Instead of editing catalina.properties, just create a "setenv.sh" in the Tomcat Bin directory with the classpath,
Example,
CLASSPATH=D:\jaa\MyJarFile.jar
I just checked the catalina.sh in Tomcat/bin and these classpath variable will be set while setting the bootstrap as the classpath.