Sahi Pro - Calling custom Java code

TypeError: Cannot call property ... in object

symptom I'm trying to use java functions from sahi but I get the following error.
TypeError: Cannot call property getCount in object [JavaPackage com.test.MyUtils]. It is not a function, it is "object".

cause The error message is not very intuitive, but what this means is that MyUtils is not available in the classpath. This is essentially a classpath problem.

resolution As mentioned above, MyUtils.class is not available in the classpath.
  • Ensure that your jar contains the MyUtils.class with the correct package heirarchy. You can use Export | Java | Jar facility from Eclipse to build your jar file. It will automatically create the correct package heirarchy.
  • Please refer to this section for details on how to add custom jars to the Sahi classpath. Ensure that you have copied the jar to the correct location.