Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » InputStream not working in Eclipse for me
InputStream not working in Eclipse for me [message #788573] Thu, 02 February 2012 00:38 Go to next message
John Hanson is currently offline John HansonFriend
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

import java.util.Scanner;
import java.io.*;

class prog201
{
  public static void main (String[] args) throws IOException
  { 
    File    file = new File("myData.txt");   // create a File object
    Scanner scan = new Scanner( file );      // connect a Scanner to the file
    int num, square;

    num = scan.nextInt();
    square = num * num ;   

    System.out.println("The square of " + num + " is " + square);
  }
}
Re: InputStream not working in Eclipse for me [message #788954 is a reply to message #788573] Thu, 02 February 2012 12:29 Go to previous message
Satyam Kandula is currently offline Satyam KandulaFriend
Messages: 444
Registered: July 2009
Senior Member
Where is the file myData.txt kept? A full absolute name could be specified or a relative path to the user directory or working directory can be specified. Look for javadoc of java.io.File for more information.
Previous Topic:[Axis2 PlugIn] Output path without src
Next Topic:How to Draw a line inside a Table?
Goto Forum:
  


Current Time: Tue Apr 23 17:33:08 GMT 2024

Powered by FUDForum. Page generated in 0.03003 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top