Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Can't open file

Posted on 2006-07-15
4
Medium Priority
?
210 Views
Last Modified: 2010-05-18
I have a file called "database" where I have the url, login and pass to have an access to my DB.

I'm using this to open it :

BufferedReader in = new BufferedReader(new FileReader("database"));

But it just won't work.
The class where this line appear is in a package.
I have put the file out of the packages and in the package, but nothing work.

I'm using J2EE and Webtools Platform.
0
Comment
Question by:matthew016
[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
  • 2
  • 2
4 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 1600 total points
ID: 17114600
Try


BufferedReader in = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("database")));
0
 
LVL 24

Assisted Solution

by:sciuriware
sciuriware earned 400 total points
ID: 17114601
You did not give the right directory/folder.
Where is your program running and where is that file?

Proove this by applying the full path name; then it works.

;JOOP!
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 17114604
And then I wanted to add what CEHJ said.

;JOOP!
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17114817
:-)
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.

Question has a verified solution.

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

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

660 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