another alternative when you initiate Torque in a servlet is to get the actual full path from the servlet:
ServletContext ctxt = getServletContext(); String path = ctxt.getRealPath("/")+"/WEB-INF/conf/"; Torque.init(path+"Torque.properties"); On Tue, 2005-03-15 at 09:48, Andras Balogh wrote: > Hello, > > Why don't You put the torque.properties file in WEB-INF/classes/ and > load it like this: > if(!Torque.isInit()) > { > PropertiesConfiguration pc = new PropertiesConfiguration(); > pc.load( > this.getClass().getClassLoader().getResourceAsStream("torque.properties") ); > > Torque.init(pc); > } > This way You don't have to hardcode any path and it will work on any > deployment. > I use this in a Servlet but I don't see why it wouldn't work in a jsp too. > > Best regards, > Andras. > > > [EMAIL PROTECTED] wrote: > > >Torque.init() requires an absolute pathname. It's a bummer. > > > >I put the true pathname in another properties file so that I do not have to > >hard-code it in the program. This does mean, however, that I have to know > >the absolute path where, in my case, Tomcat is installed. Here is my > >initialisation code > > > > apiResources = ResourceBundle.getBundle("betapi"); > > if (!Torque.isInit()) { > > String configFile = apiResources.getString > >("betapi.torqueconfig"); > > try { > > Torque.init(configFile); > > } catch (TorqueException e) { > > context.log(e,"Cannot initalise Torque: " + e.toString() > >); > > e.printStackTrace(System.err); > > System.exit(1); > > } > > } > > > >and betapi.properties contains: > > betapi.torqueconfig= > >/users/rxm1676/workspace/pmfeditor/WEB-INF/classes/Torque.properties > > > > > >In cases where I build on one machine but run on another I have a little > >shell script that that runs on installation. It tracks down the appropriate > >line in betapi.properties and adjusts it so suit where the code is actually > >installed. > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]