Here's some information to help you make sure you have placed your programs in the right place.
The most common reason while file transfer fails is procrastination, waiting until the last minute to work on the homework assignment. If you begin writing your program two days before it is due, you probably will not complete the assignment on time.
Another problem that occurs in file transfer is having the wrong
name for your program. You must give your program the
exact name, including capitalization, specified in the homework
Also, you should not place your
program in a Java
package unless a special
package name in explicitly stated in
the homework assignment.
Generally, CSCI 201 assignments do not use packages, so you
should make sure the Java keyword
appears in your program. By the way, you probably will
use packages in CSCI 202.
If you plan to transfer your files to the UNCA Computer Science server, you will need a file transfer program that uses SSH, the Secure Shell. The protocol to make this transfer is often called "sftp", for Secure FTP.
On a Linux computer, you can use the command line program sftp or you can try the very temperamental graphical application gFTP.
On a computer running Windows, we recommend WinSCP. The Information Technology group at Marlboro College has brief WinSCP tutorial for a bit more information. If you like a good command line interface, you can use the psftp program that is distributed with the PuTTY suite of secure connection programs.
On a Macintosh running OS X, you'll find the same beloved sftp command line program you can use with Linux. However, there are graphical programs available including the popular Fugu.
Undoubtedly, you've been asked to transfer a java file with a specific name, such as progname.java in your assignment. If your code was written using NetBeans 4.0, you've been using a project. Let's assume your project is named HWn. Most like your project is stored in a special project directory such as /home/yourid/csci/201/HWn on Linux or C:\Documents and Setting\yourid\HWn on Windows. In either case, your project directory has a subdirectory called src and you will find your progname.java file located there. In these two cases, the full path name for your program will be /home/yourid/csci/201/HWn/progname.java on Linux and C:\Documents and Setting\yourid\HWn\progname.java on Windows. Your mileage may vary.
If you have completely forgotten where your project is stored, start up NetBeans, open your project, and right-click on the name of your project. This will bring up a Project Properties window which will display the location of your Project Folder.
Below you can see images of how your Project Properties window should look on both Linux (first) and Windows (second). Notice the Project Folder textbox. That's the project folder directory.
Admittedly there's a bit of a chicken-and-egg problem here. How can you open a project if you don't know the name of the project folder? You will be given a list of recently opened NetBeans projects when you start NetBeans. Hopefully your project will be one of these.
You'll can also significally reduce the propability of "losing" a project by storing all your projects in one directory, like csci/201 in Linux.
Let's assume you are required to store your program in a file called progname.java within your csci/201/HWn Your program must be stored in a file named progname.java to satisfy the requirements for submitting your assignments. If it isn't, read no more. Go and fix that program.
In the following examples, we are going to use the special "word" ProjectFolderPath to denote your NetBeans project folder. This is the name of the project folder you discovered when you looked at the Project Properties window. There's a good bet that the Linux project folders start with /home and contain several forward slashes. Windows project folders probably start with C:\ and contain many backward slashes.
Remember, your project folder is ProjectFolderPath, your program name is progname.java, and your target diretory is csci/201/HWn. Then you can use the following two commands to place your program in the right location. The first command creates the directory where the program is to be stored, and the second performs the actual file transfer. Notice that in the second command, you must add /src to the end of the name of your project folder.
[yourid@yourmach yourid] mkdir -p csci/201/HWn [yourid@yourmach yourid] cp ProjectFolderPath/src/progname.java csci/201/HWn
Again, your project folder on Windows is ProjectFolderPath, your program name is progname.java, and your target diretory is csci/201/HWn.
Let's assume you are required to store your program in a file called progname.java within your csci/201/HWn This time we're going to use WinSCP to make the transfer. Of course, you'll have to install WinSCP on your Windows computer first.
We're only going to outline the use of WinSCP here. If you want detailed information about WinSCP your should read Section 5 of the UNCA CSCI 107 lab on files and directories.
Soon after you start WinSCP Login you'll see the initial WinSCP Login screen. There you should specific ftp.cs.unca.edu as the Host name and type your UNCA Computer Science account login name and password into the User name Password fields. Then you can press the Login button. You'll then be asked to accept the server key. If all of this is going to fast, go to the CSCI 107 lab.
Now you need to navigate to your Windows project folder.
This is done in the left hand panel.
In the right hand panel, you need to navigate to, and possibly create,
the assignment's target directory.
Next you click on the the filename of your program
and press the Copy icon.
Your file should be transfered to the CSCI server.
Remember, if you need more, there's that CSCI 107 lab.
Suppose you really want to make sure you have the right file in the right place. Well, you can do that will two commands: One will attempt to compile the file, and the other will try to execute it.
You'll need to start a terminal session on one of the Computer Science computers to do these commands. If you're in Robinson 004, you already have one. If you are at "home" or in a UNCA computer lab, you'll need to use a secure shell client like PuTTY to make the connection to the candler.cs.unca.edu computer.
Compile with the following:
[yourid@yourmach yourid] javac csci/201/HWn/progname.java
If this works, nothing will be printed. If you get any errors messages, you need to fix them.
Now try to execute your program with the following command. Notice the use of the -cp option to specify the classpath of your program.
[yourid@yourmach yourid] java -cp csci/201/HWn progname
If your program produces the right output, you have mastered the dropoff.