La clase es:
Código:
Y lo llamo desde el main así:package probandooctave;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/**
*
* @author tobal
*/
public class ProbarOctave {
public ProbarOctave() {
Process p = null;
Runtime r = Runtime.getRuntime();
try {
p = r.exec("/usr/bin/octave");
} catch (java.lang.Exception e) {
System.err.println("Octave's execution ERROR:");
e.printStackTrace();
}
BufferedReader is = new BufferedReader(new InputStreamReader(p.
getInputStream()));
try {
// Se lee la primera linea
String aux = is.readLine();
// Mientras se haya leido alguna linea
while (aux !=null)
{
// Se escribe la linea en pantalla
System.out.println (aux);
// y se lee la siguiente.
aux = is.readLine();
}
}
catch (Exception e) {
System.out.println("Error writing to output stream " + e);
e.printStackTrace();
}
}
}
Código:
Y al ejecutarlo sale esto:
package probandooctave;
/**
*
* @author tobal
*/
public class ProbandoOctave {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
ProbarOctave octavito =new ProbarOctave();
}
}
Código:
Y no me deja interactuar con el programa. Lo ejecuto desde NetBeans, no se si ese es el problema.run: GNU Octave, version 3.6.3 Copyright (C) 2012 John W. Eaton and others. This is free software; see the source code for copying conditions. There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, type `warranty'. Octave was configured for "i586-mandriva-linux-gnu". Additional information about Octave is available at http://www.octave.org. Please contribute if you find this software useful. For more information, visit http://www.octave.org/help-wanted.html Read http://www.octave.org/bugs.html to learn how to submit bug reports. For information about changes from previous versions, type `news'.
Debería salir esto:
Código:
Como se ve no me sale desde Java el prompt octave:1> que es el que sirve para interactuar con el programa.tobal@localhost ~ $ octave GNU Octave, version 3.6.3 Copyright (C) 2012 John W. Eaton and others. This is free software; see the source code for copying conditions. There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, type `warranty'. Octave was configured for "i586-mandriva-linux-gnu". Additional information about Octave is available at http://www.octave.org. Please contribute if you find this software useful. For more information, visit http://www.octave.org/help-wanted.html Read http://www.octave.org/bugs.html to learn how to submit bug reports. For information about changes from previous versions, type `news'. octave:1>
He consultado libros, páginas web, etc y todos ponen lo mismo.
Otra duda de lo mismo, si consigo que se ejecute correctamente, mi idea es llevarlo a un GUI con Swing, pero no se qué caja de texto es la conveniente para mostrarla, ¿cuál sería?
Gracias


