Skip to content
Get Free Trial

Adding Jars to Sahi's Classpath

While interacting with databases or while calling custom java code from Sahi scripts, the necessary jars need to be added to Sahi’s classpath.

If Sahi is started from the desktop shortcut or via commandline using start_sahi.bat or start_dashboard.bat, just copy the needed jars to sahi_pro/userdata/extlib.

If you are using ant, jars need to be copied in sahi_pro/userdata/extlib and additionally, we need to add sahi_pro/userdata/extlib as a path element to the classpath:

<target name="startsahi" description="starts proxy">
<java classname="net.sf.sahi.Proxy" fork="true">
<classpath>
<path path="classes"/>
<pathelement location="extlib/rhino/js.jar"/>
<pathelement location="extlib/apacheclient/commons-codec-1.10.jar"/>
.. and other Sahi jars ...
<pathelement location="userdata/extlib/**"/>
<pathelement location="C:/mypath/custom.jar"/>
</classpath>
<arg value="." id="basePath"/>
<arg value="./userdata/" id="userdataPath"/>
</java>
</target>

Make sure to change the pathelement locations properly. (Relative to where you are running the target from.)