Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding an external directory to Tomcat classpath

I have a folder in my C: drive as C:\app_config\java_app This folder contains some locale specific property files.

I have a java class (PrjPropertilesLocator) that loads the property files based on default locale on the startup of the web App.My web application is running inside tomcat. The problem is how should i set this directory C:\app_config\java_app in the tomcat classpath so that this becomes available to the ResourceBundle inside the PrjPropertilesLocator class. Is there a way i can set this folder specifically for a Single web app that needs it.I do not want to put the property files inside WEB-INF/classes folder.

On weblogic this runs fine.I set the directory inside the weblogic classpath in one of its startup scripts and it works fine. But on Tomcat i tried putting it in startup.bat also in setclasspath.bat, but was not able to do so successfully.

like image 585
Rajat Avatar asked Aug 19 '09 15:08

Rajat


People also ask

What is classpath in Tomcat?

A classpath is an argument that tells the JVM where to find the classes and packages necessary to run a program. The classpath is always set from a source outside the program itself.

How do I add a class to my classpath?

This can also be set in the Eclipse GUI by right-clicking on the project, selecting Properties->Java Build Path. Then select Add External Class Folder and enter the directory where you want to store your classes.


1 Answers

Just specify it in shared.loader or common.loader property of /conf/catalina.properties.

like image 179
BalusC Avatar answered Oct 24 '22 11:10

BalusC