views:

27

answers:

3
+1  Q: 

Tomcat Classpath

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

A: 

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")
Jprogyog
A: 

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

Bozho
let me put it other way...when i run the following jsp in my tomcat...<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Insert title here</title></head><body>Before:cp=<%=System.getProperty("java.class.path")%></body></html>i get this output...Before:cp=C:\apache-tomcat-6.0.24\bin\bootstrap.jar;C:\Program Files\Java\jdk1.6.0_19\lib\tools.jarHow can i make C:\Myfolder\project appear here...?How do i set this folder to my tomcat6 class path..Kaddy
Kaddy
add this to the question - it's unreadable here.
Bozho
A: 

I added the folder using the tomcat monitor. Tomcat->configuration->java->Classpath

Kaddy