title: How to call a bat from from a java program
body: <p>I have created a bat file to call a java class. Now I have created a GUI in swing. In that swing I have a button as start and for that I have action Listener in which I created the following code</p>
  
  <pre><code>public void actionPerformed(java.awt.event.ActionEvent evt)
  {
      try 
      {
  
          File file = new File("F:/myprog/start.bat");
  
          Desktop.getDesktop().open(file);
  
      } catch (IOException e)
  
      {
  
          e.printStackTrace();
  
      }
  
      jButton1ActionPerformed(evt);
  
  }
  </code></pre>
  
  <p>When I run click the button I get "<code>Error: Could not find or load main class</code>"</p>
  
  <p>Batch file : </p>
  
  <pre><code>javac *.java
  java websphinx.workbench.Workbench
   pause
  </code></pre>
  
  <p>When I click the bat file the application is running. But from Java program when I call this bat file I get the error. What went wrong?</p>