Thanks, I have tried also involing directly new Demo(), but I get a similar error
INFO|2012/06/14|17:38:01|p=Demo2|s=B957620A33E6CB25D0F0B84042FD24E7|e=0001> date: Thu Jun 14 17:38:01 CEST 2012 org.mozilla.javascript.EcmaError: ReferenceError: "Demo" is not defined. Is dependencies folder the correct place to put my DemoTools.jar where he Demo.class is defined? Toni On Thu, Jun 14, 2012 at 5:11 PM, Trip Gilman <[email protected]> wrote: > Toni, > > To access the classes in your jar file simply address them using the fully > qualified class name like you did for java.util.Date. It doesn't appear > that Demo is in the DemoTools package so that line should look like: > > var d2 = new Demo(); > > Trip Gilman > > > On 6/14/12 7:37 AM, "Toni Rincon" <[email protected]> wrote: > >>I am trying to inclode java code developped in external project as a >>jar in dependencies folder. >>But when executing the script the classes and methods in in jar are >>not available. >>Is it possible to execute code developped in other java projects from >>the script module? How is it done? >> >>Thanks. >> >>Toni >> >>Code in DemoTools.jar >>-------- >> >>import java.util.Date; >> >>public class Demo { >> public void date(){ >> Date d = new java.util.Date(); >> System.out.println("date: " + d); >> } >> >> public static void main(String [ ] args) >> { >> Demo d = new Demo(); >> d.date(); >> } >>} >> >> >>Code in the script module >>------------------------------- >>var d = new java.util.Date(); >>Log.info('date: ' + d); >> >>var d2 = new DemoTools.Demo(); >>d2.date(); >> >>Error in Tomcat logs >>------------------------------- >>INFO|2012/06/13|17:06:57|p=Demo2|s=9C0D97CF472BF12731F0768ED4F3F823|e=0001 >>> >>Action "Script" Starting >>INFO|2012/06/13|17:06:58|p=Demo2|s=9C0D97CF472BF12731F0768ED4F3F823|e=0001 >>> >>Executing script... >>INFO|2012/06/13|17:06:58|p=Demo2|s=9C0D97CF472BF12731F0768ED4F3F823|e=0001 >>> >>date: Wed Jun 13 17:06:58 CEST 2012 >>org.mozilla.javascript.EcmaError: ReferenceError: "DemoTools" is not >>defined. >> at >>org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:365 >>4) >>_______________________________________________ >>vtp-dev mailing list >>[email protected] >>https://dev.eclipse.org/mailman/listinfo/vtp-dev > > _______________________________________________ > vtp-dev mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/vtp-dev _______________________________________________ vtp-dev mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/vtp-dev
