title: NativeScript +Angular 2 + 3rd party Java Libraries
body: <p>Today I started learning nativescript. I am trying to build simple ng2 app which would use 3rd party java library.  I am trying to achieve something like in here </p>
  
  <p><a href="http://developer.telerik.com/featured/using-native-libraries-in-nativescript/" rel="nofollow">http://developer.telerik.com/featured/using-native-libraries-in-nativescript/</a></p>
  
  <p>but I keep getting undefined errors.</p>
  
  <p>I have no problem of accessing java within my ts code:</p>
  
  <pre><code>import app = require("application");
  import platform = require("platform");
  declare var java;
  .......
  public get message(): string {
          var str = new java.lang.String('Hello world!');
          var result = str.endsWith('world!');
          console.log(result); // true
  </code></pre>
  
  <p>But I can't access 3rd party java library </p>
  
  <pre><code>import {Component} from "@angular/core";
  import app = require("application");
  declare var KontaktSDK;
  
  @Component({
      selector: "my-app",
      templateUrl: "app.component.html",
  })
  export class AppComponent {
      public counter: number = 16;
  
      public onTap(args) {
          KontaktSDK.initialize("API_KEY");
          this.counter--;
      }
  }
  </code></pre>
  
  <p>It throws reference error "KontaktSDK is not defined" </p>
  
  <p>Thank you for your help!</p>