Reputation: 1266
I have a factory method in my JSP which looks for a config file in a predefined location example \abcd\configfolder\conf.xml and i have no control over this path...i currently have the file at location C:\Myfolder\project\abcd\configfolder\conf.xml and the tomcat does not find it.. so i think i need to include C:\Myfolder\project in my tomcat class path so the factory method finds conf.xml
Can any one tell me how do i make this work..
Thanks. Kaddy
Upvotes: 4
Views: 1693
Reputation: 1266
I added the folder using the tomcat monitor. Tomcat->configuration->java->Classpath
Upvotes: 0
Reputation: 597016
If you know the absolute path (via a configuration property, for example), then you can use
File configFile = new File(absolutePath);
and this will work. Actually, using a config property passed to tomcat/your app in some way is the proper way to locate the external configuration file
Upvotes: 0
Reputation: 2077
You are right Kanddy, put you file in a folder like 'conf'. Put the folder in the class path and in you code access the file by the path as
File myConfFile = new File("../conf/conf.xml")
Upvotes: 2