Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1439
  • Last Modified:

run a program that read a text file in Jcreator

Hi all
how can I run a program that read a text file in J creator. I try to run it and I have a FileNotFound exception message.  I run it in  DOS and it work.
Is there any code I   need to write in order to run it in J creator
0
vnhenry
Asked:
vnhenry
1 Solution
 
girionisCommented:
 Check that the text file you are trying to read is in the directory specified when you declare the file. If you just declare dit by its file name (i.e. no absolute path) make sure that the file is in the same place with the class files.
0
 
jonasmitCommented:
I don't use JCreator but I know JBuilder moves the .class files to a special folder when you compile and try to execute.  So you have to make sure you add the file to your IDE environment (such as JCreator).  I don't know how to do this in JCreator but you can also do it manually.To test this go to where your JCreator project is located.  Find where JCreator puts the .class files after compiling.  Put your text file in the directory with the .class file that uses your text file.  So if you have a package it needs to be in the right package level for the compiled code.
The alternative is to hard code the exact filepath to the file.  this is less desirable for portability  but...
You do not need special code though.  the JVM just can't find your file.
0
 
yongsingCommented:
JCreator creates a "classes" directory in your project directory to store the .class files. If you don't specify an absolute path for the file to read, it will read from this "classes" directory.
0
 
vnhenryAuthor Commented:
thank you all
I think that I have to create a packet to store all of the classes of my project include the textfile. so they all will have same directory.


0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now