InputStream not working in Eclipse for me [message #788569] |
Thu, 02 February 2012 00:30 |
John Hanson Messages: 2 Registered: February 2012 |
Junior Member |
|
|
I'm not sure if eclipse is doing this but. I'm not able to do inputStreams like I've been trying to. I'm trying to run a simple program. I'm not very fond with Ecplise. I'm not sure if it is the code or the program.
I come up with these errors.
FileInputStream.open(String)line: not available[native method]
FileInputStream.<init>(File)line: not available
Scanner.<init>(File)line: not available
prog201.main(String[])line: 10
I then get a window asking me where the source is.
I go to the source and it still doesn't work .
import java.util.Scanner;
import java.io.*;
class prog201
{
public static void main (String[] args) throws IOException
{
File file = new File("myData.txt");
Scanner scan = new Scanner( file );
int num, square;
num = scan.nextInt();
square = num * num ;
System.out.println("The square of " + num + " is " + square);
}
}
[Updated on: Thu, 02 February 2012 00:35] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.08124 seconds