How to use external jar library in a SAP HANA XS project

2k views Asked by At

I am trying to make an XS project in HANA which will use some of the classes and methods that can be found in a .jar file. These classes and methods will do some calculations and present it to the user in the UI.

The question is: How do I access methods and classes of that .jar file?

I have registered it as an external library, but I have no idea how to call it from my XS javascript source files.

3

There are 3 answers

0
zhaow On

there's no way to invoke external .jar package from XS's server-side JavaScript. You can use an external library using function "$.import", but this is only valid for JavaScript library.

1
AHaberl On

If you want to outsource some of your xsjs functions to an external library, xsengine provides a special format for this, called ".xsjslib". You can import a library using the following code:

$.import("<package_your_library_was_deployed>","yourLib");

access functions inside your lib by this path:

$.path.to.your.library.filename.yourFunction();
1
sestevez On

XS Server does not and will not support Java. Only Javascript...