?
Solved

run a program that read a text file in Jcreator

Posted on 2003-03-23
4
Medium Priority
?
1,358 Views
Last Modified: 2013-12-14
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
Comment
Question by:vnhenry
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 8190918
 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
 
LVL 1

Accepted Solution

by:
jonasmit earned 150 total points
ID: 8191957
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
 
LVL 9

Expert Comment

by:yongsing
ID: 8193082
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
 

Author Comment

by:vnhenry
ID: 8264268
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month12 days, 15 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question