473,473 Members | 2,357 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

readfing a text file using java error

i am having this error when trying to run:
Problem reading Threatalerts.txt
what could be my problem ?
where the file Threatalerts.txt should be stored?
this is my code

import java.io.*;
class ReadTextFile
{
public static void main ( String[] args )
{
String fileName ="Threatalerts.txt" ;
String line;

try
{
BufferedReader in = new BufferedReader(
new FileReader( fileName ) );
line = in.readLine();
while ( line != null ) // continue until end of file
{
System.out.println( line );
line = in.readLine();
}
in.close();
}
catch ( IOException iox )
{
System.out.println("Problem reading " + fileName );
}
}
}
Jul 17 '05 #1
1 2276

"GiiO" <gi******@hotmail.com> wrote in message
news:89**************************@posting.google.c om...
i am having this error when trying to run:
Problem reading Threatalerts.txt
what could be my problem ?
where the file Threatalerts.txt should be stored?


What is the actual IOException being thrown? It could be several things, but
most likely the file isn't found. Since you're catching the exception, you
won't see the real exception message unless you do e.printStacktrace(); in
the catch block.
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Xiaolei Li | last post by:
first off, i'm a total newbie at this stuff so excuse any wrong usage of terminology or whatever else. i have a XSL to transform a Document such that all "text" nodes will have a "SPAN" inserted...
7
by: Jorgen Haukland, Norway | last post by:
Hi, I have created a Java webservice which runs in IBM WebSphere appserver. I take the WSDL-file and create a VS.NET WinForm application and calls the service running on my PC and everything...
1
by: Mark P | last post by:
I've written a .Net 1.1 Web Service that receives a file and forwards the file to another Web Service (this one written in Java). The Web Service generally works, but intermittently gets the...
0
by: 123456prakash | last post by:
Hi I am getting a error while downloading application from java webstart I am using Apache 2.2 http server rnning on port 80 In that in htdocs folder I have placed my jnlp file and my jar file...
4
by: cnixuser | last post by:
Hello, I am posting reguarding some modifications I made to a text editor program that I wrote in my java class at my school today. The file I was modifying is a very simple java text editor with...
0
ak1dnar
by: ak1dnar | last post by:
There is a Error getting while i am entering records using this jsp file. <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %> <%@ include...
11
by: honguin | last post by:
Hi, With the following code, I have created a web request to a url which I am making a HTML POST with the html page request.htm, even though it makes a HTML POST, the StreamReader produces a XML...
6
by: prasath03 | last post by:
Hi, I developed one html page that contains one combo box for selectig mulltiple products to purchase with required quantity. I used innerHTML to add the textfield dynamically to enter the...
7
by: svpriyan | last post by:
Dear Buddies, I have two Java Prog: My task is to read the Content of the file and write to an XML file. so i started doing it perfectly... What i have problem is when i tried to execute the...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.