Sorry George, i still cannot read anything from my db-File.
have a look at my Packaging-Plan:
\main.jar -the main working directory with the runme.jar file
\db-2x1_db -containing the org. zip db file + the unZipped db-2x1 file
Now my working directory is: D\:J2sdk1.4\Main.jar i got a copy of db-2x1
unzipped file, this same file i got also in \db-2x1_db folder.
Appart from that i tried to specify a path for db file:
I am not very sure if this db file is OK.
maybe it is a silly Question, but I need your opinion how i should solve this.
Thanx in advance and Regards.
When you say you can't read the database file what do you mean. Getting an Exception of some kind? Or is there nothing in the file? you should be able to see the data using a good text editor (TextPad is a good start). Ok it will not be readable but at least you know there is data.
Yes i could see with a TextPad that there are some HEXdatas. I wrote a small programm called FileReader.java, i could copile it. But i cannot run it.
The result is that the system couldnot find the db file. Please have a look at my code on this Site, which i posted today. I dont know how to make a Link to that page, you know how i think, can you tell me how?
You see that is the problem.
1) Check on the URL button
2) A box should appear.
3) Post the Link to the thread within this box
3) You will then be aksed to give the link a name (You can put any thing in here you link.
Here is a link to the thread with your code.
I will have a look at is code now
Thank you very much for the how to Link.
Now if i did get you right about what you mean by the Stack Trace messege, have a look at this one:-
Microsoft Windows XP [Version 5.1.2600]
D:\J2sdk1.4\Main.jar>java -classpath runme.jar suncertify.db.FileReader
db-2x1 (Das System kann die angegebene Datei nicht finden)
at java.io.RandomAccessFile.open(Native Method)
sorry it is in a German language. It just mean the system cannot find the given file (db-2x1).
Otherwise i didnot get you right. But what do you exactly mean for the bad engliSH man like me?
Thank you so much again
Try the following code change:
Let me know, if that does not work.
If it still does not work and as you are just writting a small test app try:
[ March 16, 2004: Message edited by: Chris Harris ]
I tried the code changes. the risult is negative:
for the (".//db-2x1", r") version the result is: system cannot find the file.
the 2. one has this result:...FNFE: D\:J2sdk1.4\Main.jar\db-2x1_db system cannot find the requested path.
sorry for bothering, it is very nice of you to help me.
Let us know if you are still having problems.
Sorry but nothing works upto now.
Yes Anna db-2x1_db\ is a subdirectory of my Main.jar\ directory. the db file called db-2x1 is to be found in both of these directories.
Please have a look one more time and see what results were followed.
i just modified the
1. new RandomAccessFile("D://J2sdk1.4/Main.jar", "r");
2. new RandomAccessFile("D://J2sdk1.4/Main.jar/db-2x1_db", "r");
Result message is: D:\J2sdk1.4\Main.jar(Zugriff verweigert)-access denied.
3. and for all othe changes in the code like:
new RandomAccessFile("db-2x1", "r");
new RandomAccessFile("db-2x1_db/db-2x1", "r");
new RandomAccessFile(".//db-2x1", "r");
new RandomAccessFile("db-2x1_db", "r");
the result is: System cannot find this file.
i know it is terrible and thank you very much for your patient.
The database file should not be in a jar file.
Here's my suggestion. Copy the db-2x1 file to the same directory as the Main.jar file. That is, copy db-2x1 to the D:\J2sdk1.4 directory. Then try:
Then the database file is physically here: D:\J2sdk1.4\db-2x1
And you are refering to it by an absolute path as: "D:\\J2sdk1.4\\db-2x1"
(BTW, the double back slashes are necessary because a single back slash is an escape character for a string.)
So there should be no trouble finding it.
Let me know if this doesn't work.
Can you give this a try.
I have changed your code slightly to use my database and also added raf.close() stmt.
1. I renamed your class from FileReader to DBTest. There is a conflicting JDK class with the same, java.io.FileReader. So FileReader is not a good idea for your test program.
2. My database filename has the suffix .db. (db-2x2.db). Does your database also have a similar suffix?
3. My working directory contains the following files and directories.
+ indicates it is a directory.
From the working directory: I run the cmd to generate the runme.jar file.
jar -cvfm runme.jar Manifest.mf -C classes .
From the working directory: To run the program:
java -jar runme.jar
Note that I am running the program from the working directory where runme.jar file and the database file db-2x2.db are both present.
It is the current directory so runme.jar will definitely find the database file.
I am very glad to let you know that every thing is working. Thankx a lot for your Help, i am very gratefull.
The problem was that i was wrongly writing the db file name in the code without ".db" that means instead of "db-2x1" i was expected to write
Sorry so much for bothering you with this nonsense but at least i lerned something.
I have a starter question but i open a new topic post.