当前位置:天才代写 > JAVA代写 > 代写java OS Project – Java Shell Interface, v0.7b

代写java OS Project – Java Shell Interface, v0.7b

2018-10-18 08:00 星期四 所属: JAVA代写 浏览:95

代写java OS Implement a shell program in Java that accepts user commands and executes each command in a separate JVM process.

OS Project – Java Shell Interface, v0.7b

Objective: Implement a shell program in Java that accepts user commands and executes each command in a separate JVM process. This assignment is based on a textbook assignment.

*This shell program will run in Linux. If you do not know how to do this, I recommend installing Ubuntu in a VirtualBox VM. You can find tutorials online, but your overall goal is to install VirtualBox, download Ubuntu, then open the installer inside of VirtualBox to get it running. This video might help: https://www.youtube.com/watch?v=GGorVpzZQwA

· https://www.virtualbox.org/

· https://www.ubuntu.com/

 

Problem Description: Overall, your goal will be to create a program that allows users to enter commands. (Run cmd or PowerShell in windows or the Bash terminal in Linux to have an idea of how this should work). For example, if you run “cat readme.txt”, it should print out readme.txt to the command line.

General setup of main class. (Name it YourLastNameYourFirstNameShell).

1. Read from System input (Scanner or BufferedReader)

2. Repeat

a. Print out a prompt (“KennedyShell>” or something, similar to Bash, see above)

b. Get input

c. If it is empty input, continue

d. Otherwise, figure out the command and associated parameters

i. i.e., you need to get the “cat” command and the “readme.txt” filename out of the input string

ii. create a ProcessBuilder object (a Java feature, see below)

iii. start the process

iv. get the output stream

v. send the output to the stream (to print it out)

Creating a process – Find details for these requirements at https://docs.oracle.com/javase/7/docs/api/java/lang/ProcessBuilder.html

· Process p = new ProcessBuilder(“myCommand”, “myArg”).start();

Changing a directory

· ProcessBuilder has a method called directory.

· The current directory can be found with System.getProperty(“user.dir”)

 

Additional Feature – Implement a command, history, which when used will print out a listing of all previous commands that have been run in your program. It will print out each line with a number, beginning with 0. Additionally, the user can run historical commands by typing !x, where x is one of these numbers. The associated command will be re-run.

 

代写java OS
代写java OS

 

 

1. When the user enters the command history, print out the history.

2. When the user enters !!, run the most recent command again, or an error message if no such command exists.

3. When the user enters !X, run command #X from the history.

4. Keep accepting commands and running them until the user enters exit.

 

Test your program with various Linux commands, such as ls, cat, and pwd. See https://www.youtube.com/watch?v=YHFzr-akOas for a quick tutorial.

 

Deliverables: Submit all source code in the package edu.frostburg.cosc460.LnameFnameShell. (Only the src folder, not your whole IDE project). Fill out and include the attached post-mortem questionnaire.

Include a few screenshots of your program running. Make sure everything is in a finished, professional level of quality.

 

 

 

Checklist

Check

Requirement

%

x

Read all specs

0

Install Linux

10

Post-mortem

10

Basic program

20

Processes

20

History

30

Documentation

10

Bugs / Typos / etc

-X

 

最先出自天才代写 cs代写 作业代写 java代写 代写java服务
合作:幽灵代写
 


天才代写-代写联系方式