Differences

This shows you the differences between two versions of the page.

Link to this comparison view

muster:9.0:api:java [2018/01/10 14:01] (current)
Line 1: Line 1:
 +======= Muster Java API =======
 +
 +Before reading this section, please look at the [[muster:​9.0:​api:​scripting_guidelines|Bindings guidelines]] for the setup common to the bindings.
 +
 +===== Java =====
 +
 +The JavaApi requires you to import all the relevant .java files inside your project, or in alternative,​ build your own .jar file that hosts all the Muster .java SDK files. ​
 +
 +You may also need to distribute the MClientAPI.dll and MTemplateAPI.dll with your project. The java API does not require any additional configuration apart from setting the java class path if you plan to host the files in another directory.
 +
 +You can then import the module with:
 +
 +<code java>
 +System.loadLibrary("​MClientAPI"​);​
 +System.loadLibrary("​MTemplateAPI"​);​
 +</​code>​
 +
 +This is a sample code snippets that initialise the library:
 +
 +<code java>
 +public class mustersample
 +{
 + public static void main(String[] args) {
 +
 + System.loadLibrary("​MClientAPI"​);​
 +
 + try {
 + MUSTERERR err = MClientAPI.InitializeLibrary(""​);​
 + if (err.getErrorCode() != 0) {
 + System.out.println("​MClientAPI initialization failed!"​);​
 + return;
 + }
 + }
 +
 + catch (Exception exc) {
 + System.out.println(exc);​
 +
 + }
 + }
 +}
 +</​code>​
 +