hi everybody! I'm new in this world of java and I've been trying to make my program get a string from a txt file that i have. Look here is my code:
This is the error that it shows me:
Exception in thread "main" java.io.FileNotFoundException: Regitros.txt (No such file or directory)
at java.io.FileInputStream.open(Native Method)
I have that Registros.txt in the same folder that I have the Main.java but it ain't still working :S any idea or how can I specify the file path, I'm using a Macbook I think that the path to something differ from the paths of windows since in windows there is a C:/ and here there's the Macintosh HD so pleasee help !! for getting my file read.
Code:
public class Main {
private static BufferedReader stdIn = new
BufferedReader(new InputStreamReader(System.in));
private static PrintWriter stdOut = new
PrintWriter(System.out,true);
private static PrintWriter fileOut;
private static BufferedReader fileIn;
public static void main(String args[]) throws IOException
{
String a;
fileIn=new BufferedReader(new FileReader("Regitros.txt"));
a=fileIn.readLine();
System.out.println(a);
fileIn.close();
}
This is the error that it shows me:
Exception in thread "main" java.io.FileNotFoundException: Regitros.txt (No such file or directory)
at java.io.FileInputStream.open(Native Method)
I have that Registros.txt in the same folder that I have the Main.java but it ain't still working :S any idea or how can I specify the file path, I'm using a Macbook I think that the path to something differ from the paths of windows since in windows there is a C:/ and here there's the Macintosh HD so pleasee help !! for getting my file read.