Java Reference
In-Depth Information
Files on Your Desktop
We'll do all of our work on the Desktop because that's the easiest place for you to
find files, and it's the same across Windows, Mac, and Linux.
Out in the real world you probably wouldn't want to clutter up your Desktop with
each new project you work on. But until you get more comfortable moving things
around and setting things up, stick to the Desktop.
If It Doesn't Work
One area where you might run into problems is if your home directory contains
spaces. For instance, if you're on Windows and your name is “John Smith,”
typing in a command using the tilde, like this:
$ cp ~/Desktop/code/HelloWorld/build.sh .
makes it look like you typed this:
$ cp C:/Users/John Smith/Desktop/code/HelloWorld/build.sh .
The computer interprets that as saying “copy C:/Users/John and Smith/Desktop/code/
HelloWorld/build.sh ” to the current directory. You'll get the error that there is “no
such file or directory.”
You have two workarounds: you can use a relative path, by typing “..” for
parent directories, so you go “up two” and down into code :
$ cp ../../code/HelloWorld/build.sh .
Or just type it in by hand, using quotation marks around the file name:
$ cp "C:/Users/John Smith/Desktop/code/HelloWorld/build.sh" .
Another problem you might run into is not being in the directory that you
think you are. When in doubt, you can always do a pwd command to print
your current working directory:
$ pwd
/Users/andy/Desktop
Here I'm in my Desktop directory, which is where we'll be starting off for most
of our work.
Start at the Desktop
On most systems, you should be able to type cdDesktop to get to your Desktop.
If that doesn't work, you may need to type cd~/Desktop —using the tilde short-
cut—or you might need to spell the whole thing out, as in cd/Users/andy/Desktop .
 
 
 
Search WWH ::




Custom Search