title: Dynamic Link Library & Java
body: <p>I made a dll in C++ and wrote this class in java:</p>
  
  <pre><code>public class VolumeControl {
  
      public native float GetVolume();
  
      public native void SetVolume(float val);
  
      public native void VolumeUp();
  
      public native void VolumeDown();
  
      public native void Mute();
  
      static {
           System.load("some_path/VolumeControl.dll");
      }
  }
  </code></pre>
  
  <p>it works good, if I call functions from this file, but when I'm trying  to do this:</p>
  
  <pre><code>public class Server {
  
      public static void main(String[] args) {
          VolumeControl ctrl = new VolumeControl();
          ctrl.Mute();
      }
  }
  </code></pre>
  
  <p>I get this: </p>
  
  <pre><code>Exception in thread "main" java.lang.UnsatisfiedLinkError:
  RemoteControl.VolumeControl.Mute()V
  </code></pre>
  
  <p>Both classes are in the same package, of course. How can I solve it? Thanks.</p>
  
  <p><strong>Update1</strong>: OK the problem was, that I added these classes to package. When I move them to default package, everything works good. But now if I want to use this dll with different packages, I need to rebuild it.</p>
  
  <p><strong>Update2</strong>: Actually I can't add it to package at all, when I'm trying: #javah VolumeControl, I get Error: </p>
  
  <pre><code>Could not find class file for 'VolumeControl'.
  </code></pre>
  
  <p><strong>Update3</strong>: I added manually name of package to C++ functions and it works. Thanks. </p>