maxima --server 9734



Chris,

I don't understand why your code isn't working; I adapted the code
you posted into a similar program (appended to this message)
which seems to work OK. E.g.

$ java RunProgram `which maxima` 'print(FOO);'
to be sent to /usr/local/bin/maxima: print(FOO);
output from /usr/local/bin/maxima:
Maxima 5.11.0cvs http://maxima.sourceforge.net
Using Lisp GNU Common Lisp (GCL) GCL 2.6.7 (aka GCL)
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
This is a development version of Maxima. The function bug_report()
provides bug reporting information.
(%i1) FOO
(%o1)                          FOO
(%i2)


Did you perhaps omit close() or flush() on the output stream?
What are the operating system, Lisp, and Maxima versions you
are working with? What happens if you try RunProgram with,
say, /bin/cat as the program to run?

Something of a tangent -- maybe this message is useful to you.
http://article.gmane.org/gmane.comp.mathematics.maxima.general/13448

Sorry I can't be more helpful,
Robert Dodier

PS.
import java.io.*;

public class RunProgram
{
    public static void main (String [] a)
    {
        try
        {
            Process p = Runtime.getRuntime().exec (a[0]);

            BufferedWriter to         = new BufferedWriter (new
OutputStreamWriter (p.getOutputStream ())) ;
            BufferedReader from       = new BufferedReader (new
InputStreamReader (p.getInputStream ())) ;
            BufferedReader err_from   = new BufferedReader (new
InputStreamReader (p.getErrorStream ())) ;

            System.err.println ("to be sent to " + a[0] + ": " + a[1]);

            to.write (a[1], 0, a[1].length ());
            to.close ();

            System.err.println ("output from " + a[0] + ":");
            String s = from.readLine ();
            while (s != null)
            {
                System.out.println (s);
                s = from.readLine ();
            }
        }
        catch (Exception e) { e.printStackTrace (); }
    }
}