//ConsoleWindow.java import java.io.*; public class shell extends VMachine { String shhname; boolean initialrun; String initialworker; public shell () {// Used when new instance created } public shell (String name, String worker) {// Used when creating a shell and executing a worker // Also used for initial startup shhname = name; initialworker = worker; initialrun = true; } public shell (String name) {// Used when creating new shell ConsoleWindow console = new ConsoleWindow(name); } public void run () { sysapi.Write(OUT,"% "); String str = sysapi.Read(IN); String exitstr = str.toLowerCase(); while(exitstr.compareTo("exit") != 0)//console.Active()) { if(str!=null) { execute(str); if(sysapi.findUser(owner).isClosing) { break; } } sysapi.Write(OUT,"% "); str = sysapi.Read(IN); exitstr = str.toLowerCase(); } sysapi.Exit(vmh,owner); //console.dispose(); //console.Always_Wait_For_Finish(); //System.exit(0); } public void execute(String strworker) { String cmdargs = new String(); // Arguments Passed to Workers VMachine vm1 = null; FileClassLoader fileclass = null; fileclass = new FileClassLoader(); fileclass.bindir = "C:\\java\\OSVM\\bin\\"; Class newclass = null; int argstart; try { //This temporary section is in place until parser is implemented argstart = strworker.indexOf(" "); if(argstart != -1) { cmdargs = strworker.substring(argstart+1); strworker = strworker.substring(0,argstart); } strworker = strworker.trim(); newclass = fileclass.loadCmd(strworker); //console.out.println("Loaded class " + newclass.getName() ); try { Handle vmh1 = sysapi.CreateVM(IN,OUT,newclass,owner,cmdargs,this,null,null,0); sysapi.findUser(owner).addHandle(vmh1); sysapi.Compute(vmh); } catch(Exception ex) { sysapi.Write(OUT,"Program could not execute.\n"); //ex.printStackTrace(); } } catch(Exception ex) { sysapi.Write(OUT,"Command not recognized or not found.\n"); //ex.printStackTrace(); } } };