title: Run JAR file in PHP and write a file
body: <p>I have the following problem in php when excecuting a jar file. I use the following command:</p>
  
  <pre><code>exec("java -jar JavaProject4.jar";
  </code></pre>
  
  <p>The JavaProject4.jar creates a txt file in a path given in the java code. </p>
  
  <p>When i run the project in NetBeans the txt file is created. However, when i excecute the jar in php i don't get any errors but i can't get the file. </p>
  
  <p>Here the java code I use to write the file:</p>
  
  <pre><code>public static void main(String[] args) throws InterruptedException, FileNotFoundException, IOException {
  
      Main a = new Main();
      List&lt;Double&gt; l1 = new ArrayList&lt;Double&gt;();
  
      l1 = a.compute_features();
      //System.out.println(l1);
  
      FileWriter fstream1 = new FileWriter("C:/wamp/www/test/out.txt");
      BufferedWriter out1 = new BufferedWriter(fstream1);
      out1.write(l1.toString());
      out1.newLine();
      out1.close();
  }
  </code></pre>
  
  <p>Im using a wamp server with php 5.2.4 and the latest java version. </p>
  
  <p>Thanks a lot!</p>
  
  <p>EDIT:
  Problem solved, I moved the main java file in NetBeans to the default package and also fixed a wrong path and now everything is working as expected. </p>
  
  <p>Thanks everyone</p>