title: How to pack APIs into JARs
body: <p>I have a GUI program that returns CPU values, this requires a external API. I have the JAR made, but the program will not return the CPU unless I run the program within netbeans IDE. My question is how can I pack APIs into a JAR file.</p>
  
  <pre><code>private class getCpu extends Thread {
          @Override
          public void run() {
              while(true) {
                  try {
                  Sigar sigar = new Sigar();
                  Cpu cpu = new Cpu();
                  CpuPerc perc = sigar.getCpuPerc();
  
                  DecimalFormat df = new DecimalFormat("###.###");
                  //df.format(100-(perc.getIdle()*100));
                  cpuLabel.setText("CPU : "+df.format(100-(perc.getIdle()*100))+"%");
  
                  try{Thread.sleep(1000);}catch(Exception e2){}
                  }catch(SigarException e1){}
                  catch(Exception e){}
              }
          }
      }
  </code></pre>