code: private static void invokeOctave(File dataMatrixFile, File affMatrixFile, 
                                       int dimensions, File outputFile) 
              throws IOException {
  
          // Create the octave file for executing
          File octaveFile = File.createTempFile("octave-LPP",".m");
          // Create the Matlab-specified output code for the saving the matrix
          String outputStr = 
              "save(\"-ascii\", \"" + outputFile.getAbsolutePath()
              + "\", \"projection\");\n";
          
          String octaveProgram = null;
          try {
              // Fill in the Matlab-specific I/O 
              octaveProgram = String.format(SR_LPP_M,
                                            dataMatrixFile.getAbsolutePath(), 
                                            affMatrixFile.getAbsolutePath(),
                                            dimensions, outputStr);
          } catch (Throwable t) {
              t.printStackTrace();
          }
          PrintWriter pw = new PrintWriter(octaveFile);
          pw.println(octaveProgram);
          pw.close();
          
          // build a command line where octave executes the previously constructed
          // file
          String commandLine = "octave " + octaveFile.getAbsolutePath();
          LOGGER.fine(commandLine);
          Process octave = Runtime.getRuntime().exec(commandLine);
  
          BufferedReader stdout = new BufferedReader(
              new InputStreamReader(octave.getInputStream()));
          BufferedReader stderr = new BufferedReader(
              new InputStreamReader(octave.getErrorStream()));
  
          // Capture the output for logging
          StringBuilder output = new StringBuilder("Octave LPP output:\n");
          for (String line = null; (line = stdout.readLine()) != null; ) {
              output.append(line).append("\n");
          }
          LOGGER.fine(output.toString());
  	    
          int exitStatus = -1;
          try {
              exitStatus = octave.waitFor();
          } catch (InterruptedException ie) {
              throw new Error(ie);
          }
          LOGGER.fine("Octave LPP exit status: " + exitStatus);
  
          // If Octave wasn't successful, throw an exception with the output
          if (exitStatus != 0) {
              StringBuilder sb = new StringBuilder();
              for (String line = null; (line = stderr.readLine()) != null; ) {
                  sb.append(line).append("\n");
              }
              throw new IllegalStateException(
                  "Octave LPP did not finish normally: " + sb);
          }
      }
docs: Invokes Octave to run the LPP script