Question: Please use command to run code and show the output screenshot Thank You!!! This project consists of modifying a Java program so that it serves

 Please use command to run code and show the output screenshot

Thank You!!! This project consists of modifying a Java program so that

it serves as a shell interface that rnal to the accepts user

commands and then executes each command in a separate process exte Java

Please use command to run code and show the output screenshot Thank You!!!

This project consists of modifying a Java program so that it serves as a shell interface that rnal to the accepts user commands and then executes each command in a separate process exte Java virtual machine. A shell interface provides the user with a prompt, after which the user enters the next command. The example below illustrates the prompt jsh> and the user's next command: cat Prog.java. This command displays the file Prog.java on the terminal using the UNIX cat command: jsh> cat Prog.java queformplementingashellinterfaceistohavetheprogramfirstrea what the user enters on the command line (here, cat Prog. java) and then create a separate external process that performs the command. We create the separate process using the ProcessBuilder() object, as illustrated in Figure 3.13. In our example, this separate process is external to the JVM and begins execution when its run() method is invoked. A Java program that provides the basic operations of a command-line shell is supplied below. The main() method presents the prompt jshs> (for java shell) and waits to read input from the user. The program is terminated when the user enters import java.io.*; public class SimpleShell ( public static void main (String [ args) throws IOException string commandLine; BufferedReader console new BufferedReader (new InputStreamReader (System.in))i //we break out with while (true) t //read what the user entered System.out.println ("jsh>") commandLine = console.readLine(); //if the user entered a return, just loop again if (commandLine.equals("")) continue

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!