Update of /cvsroot/aimmath/AIM/WEB-INF/java
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8765/WEB-INF/java
Added Files:
Tag: aim-xml
Zog.java compile.bat compzog.bat
Log Message:
--- NEW FILE: Zog.java ---
import java.util.*;
import java.io.*;
class StreamGobbler extends Thread
{
InputStream is;
String type;
StreamGobbler(InputStream is, String type)
{
this.is = is;
this.type = type;
}
public void run()
{
try
{
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line=null;
while ( (line = br.readLine()) != null)
System.out.println(type + ">" + line);
} catch (IOException ioe)
{
ioe.printStackTrace();
}
}
}
public class Zog
{
public static void main(String args[])
{
try
{
String osName = System.getProperty("os.name" );
String[] cmd = new String[5];
// cmd[0] = "cmd.exe";
// cmd[1] = "/c";
// cmd[2] = "cmaple9.5.exe -q -c print(2+2) -c quit";
cmd[0] = "C:/Program Files/Maple 9.5/bin.win/cmaple9.5.exe";
cmd[1] = "-c";
cmd[2] = "print(2+2)";
cmd[3] = "-c";
cmd[4] = "quit";
Runtime rt = Runtime.getRuntime();
// System.out.println("Execing " + cmd[0] + " " + cmd[1] + " " + cmd[2] + " " + cmd[3] + " " + cmd[4]);
Process proc = rt.exec("C:/Program Files/Maple 9.5/bin.win/cmaple9.5.exe");
// any error message?
// StreamGobbler errorGobbler = new
// StreamGobbler(proc.getErrorStream(), "ERROR");
// any output?
StreamGobbler outputGobbler = new
StreamGobbler(proc.getInputStream(), "OUTPUT");
OutputStream os = proc.getOutputStream();
PrintWriter pw = new PrintWriter(os,true);
System.out.println("T0");
pw.print("fopen(\"C:/zzz.txt\",APPEND):fprintf(\"C:/zzz.txt\",\"A: %d\\n\",iolib(25)):fclose(\"C:/zzz.txt\"):printf(\"a: %d\\n\",iolib(25)):");
os.write("\r\n".getBytes());
System.out.println("T1");
pw.flush();
System.out.println("T2");
pw.print("fopen(\"C:/zzz.txt\",APPEND):fprintf(\"C:/zzz.txt\",\"B: %d\\n\",iolib(25)):fclose(\"C:/zzz.txt\"):printf(\"b: %d\\n\",iolib(25)):");
os.write("\r\n".getBytes());
System.out.println("T3");
pw.flush();
System.out.println("T4");
pw.print("quit;");
os.write("\r\n".getBytes());
System.out.println("T5");
pw.flush();
System.out.println("T6");
// pw.close();
System.out.println("T7");
// kick them off
// errorGobbler.start();
outputGobbler.start();
// any error???
int exitVal = proc.waitFor();
System.out.println("ExitValue: " + exitVal);
} catch (Throwable t)
{
t.printStackTrace();
}
}
}
// Local Variables:
// c-basic-offset: 2
// compile-command: "compzog.bat"
// End:
--- NEW FILE: compile.bat ---
SET CLASSPATH=C:\Sun\AppServer\lib\j2ee.jar;C:\Sun\AppServer\jdk\lib;C:\Tomcat\common\lib\xerces\xercesImpl.jar;..\classes
C:\Sun\AppServer\jdk\bin\javac -d ..\classes Maple.java
C:\Sun\AppServer\jdk\bin\javac -d ..\classes MaplePool.java
C:\Sun\AppServer\jdk\bin\javac -d ..\classes tth\TtH.java
C:\Sun\AppServer\jdk\bin\javac -d ..\classes Alice.java
--- NEW FILE: compzog.bat ---
SET CLASSPATH=C:\Sun\AppServer\lib\j2ee.jar;C:\Sun\AppServer\jdk\lib;C:\Tomcat\common\lib\xerces\xercesImpl.jar
C:\Sun\AppServer\jdk\bin\javac Zog.java
|