title: Running jar file and Calling a method from main method in java
body: <p>I have made a JFrame application in which i have made a method and added a button with button click event.Now i have called this method from button click as well as from main method .As per my need i need to run this application as jar file..If jar file has been run it should execute the method directly and if button is clicked it should again invoke the same...</p>
  
  <p>Now the problem is this that while executing it on Netbeans IDE its working file but while executing it from jar file it is giving error..</p>
  
  <p>Here is My code..</p>
  
  <p>Method:</p>
  
  <pre><code>       public static void captureCDRProcess(){}
  </code></pre>
  
  <p>Button click event.</p>
  
  <pre><code> button.addActionListener(new ActionListener() {
  
          public void actionPerformed(ActionEvent ae) {
  
              captureCDRProcess();
  
          }
      });
  </code></pre>
  
  <p>and here is my main method:</p>
  
  <pre><code> public static void main(String args[]) {
  
      captureCDRProcess(); 
  
      JframeGuiProcessingCDRcallCost frame = new JframeGuiProcessingCDRcallCost() {
          @Override
          public void actionPerformed(ActionEvent e) {
              throw new UnsupportedOperationException("Not supported yet.");
          }
      };
  
  
      frame.setTitle("Process Cdr");
      frame.setSize(600, 400);
      frame.setLocation(200, 100);
      frame.getContentPane().setBackground(Color.cyan);
      frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
      frame.setVisible(true);
  
  }
  </code></pre>