I'm trying to run this code that was supposed to be a cut and paste easy assignment from my teacher. However, after following the instructions I still get this error message:
"The specified file, ShapeData.txt was not found."
which refers back to line 30.
I did cut and paste the file into the same folder as all the rest, so i'm not sure why I'm still getting the error. I also read about doing something in the command line, but not sure what it is I'm suppose to do.
(Oh, and this is not a homework assignment or anything that I can turn in for a grade. It is just something we can look at to get a better understanding.)
Here is my code, or at least the first couple of line anyway.
/**
* Concepts demonstrated:
* Object Inheritance
* Interfaces
* Interface Implementation
* Reading Data from a File
* Sorting an Array
* Manipulating Strings
*/
import java.util.Scanner;
/**
* This lab demonstrates the basics of object-oriented programming.
*/
public class Lab8 {
private static Shape[] shapes; // An array to hold all the shape objects
public static void main(String[] args) {
DataReader reader = new DataReader("ShapeData.txt");// The reader is used to read data from a file
// Display program information
System.out.println("Ima Java Programmer");
System.out.println("Shape Info");
// Load data from the file
if(reader.loadData("ShapeData.txt")) { // The filename is entered using a command-line argument
shapes = reader.getShapeData(); // Store the arrays in the array
// Display how many shapes were read from the file
System.out.println("Successfully loaded " + shapes[0].getCount() +
" shapes from the selected data file!");
displayMenu();
}
}