java-introcs StdOut
.
If working, it will print 4 different data types.
(For old installer, use java StdOut
.)
You can repeat with StdIn
, StdDraw
,
StdAudio
. If not working, ask course staff.
Can be caused by moving/deleting files installed by installer.
myVeryLongNameDir
, type cd m
and then press Tab.
The rest will be typed automatically for you. (If there
are multiple possible completions, look at what is printed and/or press
Tab some more.) Extra useful for filenames with spaces.
To do this: | Type on PC Command Prompt | Type on Mac Terminal |
---|---|---|
What is my current directory? | cd |
pwd |
Show contents of current directory | dir |
ls |
Move to subdirectory «sub» (relative path) |
cd «sub» |
|
Move to parent directory | cd .. |
|
Move to your user account directory (absolute path) (Note the different slash directions) |
cd \Users\«username»
(Separately type c: first if on a different drive)
|
cd /Users/«username» |
View the contents of file «filename» * |
more «filename» |
|
Compile MyClass.java w/ Std libraries† |
javac-introcs MyClass.java
(For old installer javac MyClass.java )
|
|
Run program MyClass with Std libraries† |
java-introcs MyClass arg0 arg1 ...
(For old installer java MyClass arg0 arg1 ... )
|
|
Read standard input from a file named infile.txt †* |
java-introcs MyClass arg0 arg1 ... < infile.txt |
|
(Over)write standard output to a file named outfile.txt †* |
java-introcs MyClass arg0 arg1 ... > outfile.txt |
|
Pipe output of first command to input of second command | «first command» | «second command» |
|
(You can combine the three above things)†* |
E.g, java HelloWorld | java-introcs Sort > hi.txt
E.g, java-introcs Sort < input.txt > output.txt
|
|
Terminate program | Control-C (this is not Copy!) |
|
Copy text (to clipboard) | Drag-select with mouse then Enter | Drag-select with mouse |
Paste text (at current cursor) | Right-click in terminal/command prompt window | |
End of typed-in standard input (EOF) | Control-Z on own line then Enter |
Control-D |
Optional: delete, move, copy file; make/remove dir | del move copy mkdir rmdir |
rm mv cp mkdir rmdir |