Re: Question: How do I read info into a java application from a file (txt) and through regular args
"shalom cohen" <firstname.lastname@example.org> wrote:
>I am new to java and have a question.
>Question: How do I read info into a java application from a
> file (txt) and through regular args in javac line?
Pass the file name as a command line argument. Use the BufferedReader class
to read the text file in your program:
FileInputStream istream = new FileInputStream(args);
BufferedReader reader = new BufferedReader(istream);
while((line = reader.readLine()) != null)
// whatever you want to do with the text
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL