Return-Path: Delivered-To: apmail-jakarta-velocity-user-archive@www.apache.org Received: (qmail 4971 invoked from network); 18 Nov 2003 03:43:28 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 18 Nov 2003 03:43:28 -0000 Received: (qmail 39002 invoked by uid 500); 18 Nov 2003 03:43:06 -0000 Delivered-To: apmail-jakarta-velocity-user-archive@jakarta.apache.org Received: (qmail 38976 invoked by uid 500); 18 Nov 2003 03:43:06 -0000 Mailing-List: contact velocity-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Velocity Users List" Reply-To: "Velocity Users List" Delivered-To: mailing list velocity-user@jakarta.apache.org Received: (qmail 38961 invoked from network); 18 Nov 2003 03:43:05 -0000 Received: from unknown (HELO lmout01.st1.spray.net) (212.78.202.120) by daedalus.apache.org with SMTP; 18 Nov 2003 03:43:05 -0000 Received: from lycos.co.uk (lmcodec01 [212.78.202.57]) by lmout01.st1.spray.net (Postfix) with SMTP id 3B22A1FB35 for ; Tue, 18 Nov 2003 04:43:14 +0100 (MET) From: "Manjush G. Menon" To: "Velocity Users List" References: <3FB732F2.7080708@designat7.co.zw> <40E3F4E4-184A-11D8-9BEA-000A95A01192@optonline.net> <3FB88D2B.3020700@designat7.co.zw> Subject: Re: Problem merging template ResourceNotFoundException Date: Tue, 18 Nov 2003 09:16:24 +0530 X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Message-Id: <20031118034314.3B22A1FB35@lmout01.st1.spray.net> X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hi, This is probably what you need: Set the resource class loader in the properties object as below: Properties properties = null; if(properties == null){ properties = new Properties(); properties.put("resource.loader", "class"); properties.put("class.resource.loader.description","Template Class Loader"); properties.put("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); VelocityEngine ve = new VelocityEngine(); //use it to initiate the Velocity Engine ve.init(properties); //Now this should work template = ve.getTemplate("Template.vm"); context = new VelocityContext(); context.put("FNAME", "Manjush"); .......... StringWriter writer = new StringWriter(); template.merge(context, writer); Hope this helps -- Thanks Manjush ----- Original Message ----- From: "kwirirai" To: "Velocity Users List" Sent: Monday, November 17, 2003 2:26 PM Subject: Re: Problem merging template ResourceNotFoundException > In the same directory as the class file , I am using NetBeans to run the > app. > > Geir Magnusson Jr. wrote: > > > Where are you putting the file? > > > > On Nov 16, 2003, at 3:18 AM, kwirirai wrote: > > > >> Hi guys > >> I am having this problem when running the Example2 app : > >> Problem merging template : > >> org.apache.velocity.exception.ResourceNotFoundException: Unable to > >> find resource 'example2.vm' > >> I have tried adding the set the resource loader property to point > >> to the correct directory , it still cannot find the file > >> I have no more ideas on making it run,could you please help > >> > >> thanks > >> kwiri > >> > >> > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org > >> For additional commands, e-mail: velocity-user-help@jakarta.apache.org > >> > >> > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: velocity-user-help@jakarta.apache.org > > > --------------------------------------------------------------------- To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: velocity-user-help@jakarta.apache.org