aspose file tools*
The moose likes Beginning Java and the fly likes need some help with a project Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "need some help with a project" Watch "need some help with a project" New topic
Author

need some help with a project

vincent donald
Greenhorn

Joined: Sep 09, 2010
Posts: 10
I have writen this code,It is for one of my projects.It is suppose to read data from a file,that i specify the name of file for and then print out the details.the problem is that it does compile with no errors but if I try to run it in netbean 6.7.1 my ide then it gives me an error:

Exception in thread "main" java.io.FileNotFoundException: test (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.util.Scanner.<init>(Scanner.java:636)
at importdataprocess.importDataProcess.main(importDataProcess.java:29)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)


so that is the error and this then is my code:
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 9990
    
    7

Like the exception says, the file you are trying to access does not exist.
Which file you might wonder.
This one

And like you were requested in the other thread, in future, while posting code, please UseCodeTags


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
vincent donald
Greenhorn

Joined: Sep 09, 2010
Posts: 10
Maneesh Godbole wrote:Like the exception says, the file you are trying to access does not exist.
Which file you might wonder.
This one

And like you were requested in the other thread, in future, while posting code, please UseCodeTags



so can i take the exception out or what code can i use to get this rite?
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 9990
    
    7

Nothing wrong with the code. In fact it is a good code because it tells you what is going wrong, viz. FileNotFound

Does a file named "test" exist? Your code is trying to look for that.
Either make sure such a file exists or change the code to point to a file which exists.
vincent donald
Greenhorn

Joined: Sep 09, 2010
Posts: 10
Maneesh Godbole wrote:Nothing wrong with the code. In fact it is a good code because it tells you what is going wrong, viz. FileNotFound

Does a file named "test" exist? Your code is trying to look for that.
Either make sure such a file exists or change the code to point to a file which exists.


vincent doald
I have made a file and I have put it in the folder where the class file is,and the second time around I placed it in the (C Drive tested it, but i did redirect the path name to the C: Drive.If you tel the code to go and get the file where does it go and look by defualt in the class file?but what I think what I'am going to do now is create a program First that can write to a file and then,Run my existing program after that to fetch the info.
pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
vincent donald wrote:If you tel the code to go and get the file where does it go and look by defualt in the class file?


Let Java tell you where it's looking:
vincent donald
Greenhorn

Joined: Sep 09, 2010
Posts: 10
pete stein wrote:
vincent donald wrote:If you tel the code to go and get the file where does it go and look by defualt in the class file?


Let Java tell you where it's looking:
vincent donald
Thanks.just one more question mt ide netbean 6.7.1/jdk 1.6. If i rite a program and i want to use TextIO it does not allow me to use that code what can i do to get it to work?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36508
    
  16
What's TextIO? Why have you changed the text colour? That confused me into thinking it was a link. Where is your TextIO file?
vincent donald
Greenhorn

Joined: Sep 09, 2010
Posts: 10
Campbell Ritchie wrote:What's TextIO? Why have you changed the text colour? That confused me into thinking it was a link. Where is your TextIO file?


Sorry for that.Like I understand it,it is a class file and can be used instead of Scanner class.But it seams to me that my ide does not support it.So the queston would be is there a way i can get my ide libary to get that file imported so that i can use it as a class and aswell use the static members of the class?
pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
vincent donald wrote:
Campbell Ritchie wrote:What's TextIO? Why have you changed the text colour? That confused me into thinking it was a link. Where is your TextIO file?


Sorry for that.Like I understand it,it is a class file and can be used instead of Scanner class.But it seams to me that my ide does not support it.So the queston would be is there a way i can get my ide libary to get that file imported so that i can use it as a class and aswell use the static members of the class?


TextIO is an input-output (IO) class that is a 3rd party jar file available for download. Your IDE can support it and any other 3rd party jar file (including your own), if you set up the IDE correctly. I can tell you how to do this with Eclipse but not for other IDEs.

So... do you have the Jar file? and What IDE are you using?

Also, since this is a 3rd party class and not part of standard Java, I doubt if many people here can help you with any problems you may have with it.
vincent donald
Greenhorn

Joined: Sep 09, 2010
Posts: 10
pete stein wrote:
vincent donald wrote:
Campbell Ritchie wrote:What's TextIO? Why have you changed the text colour? That confused me into thinking it was a link. Where is your TextIO file?


Sorry for that.Like I understand it,it is a class file and can be used instead of Scanner class.But it seams to me that my ide does not support it.So the queston would be is there a way i can get my ide libary to get that file imported so that i can use it as a class and aswell use the static members of the class?


TextIO is an input-output (IO) class that is a 3rd party jar file available for download. Your IDE can support it and any other 3rd party jar file (including your own), if you set up the IDE correctly. I can tell you how to do this with Eclipse but not for other IDEs.

So... do you have the Jar file? and What IDE are you using?

Also, since this is a 3rd party class and not part of standard Java, I doubt if many people here can help you with any problems you may have with it.


Whith my study material came i file TextIO.java is it that one? But otherwise no other file with that name on my pc.I am using netbean 6.7.1(is this a good IDE i got it with my Studying material) I find it not so hard to understand i learned it in a few days the basic functions.I really dont now why they use TextIO, i just use Scanner class instead.But i just want to do it anyway for a later stage when i am going to do the other excercises that involve the TextIO.
pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
vincent donald wrote:
Whith my study material came i file TextIO.java is it that one?

That looks like a good bet to me.

But otherwise no other file with that name on my pc.I am using netbean 6.7.1(is this a good IDE i got it with my Studying material) I find it not so hard to understand i learned it in a few days the basic functions.I really dont now why they use TextIO, i just use Scanner class instead.But i just want to do it anyway for a later stage when i am going to do the other excercises that involve the TextIO.

NetBeans is a fine IDE, but in some ways you may be better off skipping the IDE, using a decent code editor such as Notepad++, and compiling and running on the command line. Doing it this way means you only have to concentrate on learning Java rather than having to learn two things -- Java and a monstrously huge and complex IDE.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: need some help with a project
 
Similar Threads
cannot get the info from disk file
Reading a file using Scanner
File Not Found Error
Reading from multiple files using Scanner to extract data
Parsing a text file to an arraylist