Hello Everybody:
I downloaded FBN assignment. Read few times instruction and went through all source code. They supplied four classes and one Binary db.db. I have two problems. Anybody please help me. I appreciate any response.
1.I wanted to view content of db.db. I opened it using notepad. I see some black squares. I opened type db.db on DOS PROMPT. I see heart, spade, diamond, and some other symbols. I want to see programmatically how db.db is oraganized? I added main method in Data.java file for my
testing purpose.
public static void main(
String[] args) throws IOException {
new Data("db.db");
}
Added few System.out.println in its first constructor to view at data.
.....
headerLen = db.readInt();
System.out.println(headerLen);
int nFields= db.readInt();
System.out.println(nFields);
recordCount = db.readInt();
System.out.println(recordCount);
description = new FieldInfo[nFields];
for (int i=0; i<nFields; i++) {<br /> description[i] = new FieldInfo(db.readUTF(), db.readInt());<br /> recordLen += description[i].getLength();<br /> System.out.println(description[i].getName());<br /> System.out.println(description[i].getLength());<br /> }.....<br /> I complied as below:<br /> A:\scjd\starting>javac suncertify\db\Data.java
Note: suncertify\db\Data.java uses or overrides a deprecated API.
Note: Recompile with -deprecation for details.
Got message for -deprecation for details and compiled fine. At the run time I am getting following errors.
A:\scjd\starting>
java suncertify\db\Data
Exception in
thread "main" java.lang.NoClassDefFoundError: suncertify\db\Data
wrong name: suncertify/db/Data)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
How to handle this? First I want to understand their db.db setting. How to dump out contents of db.db so I can think simple GUI?
2.Instruction says we have to enhance Data class. It requires to implement criteriaFind(), lock(), and unlock() methods. I see lock and unlock methods. But I do not see criteriaFind. Is it we have to add new method in Data class?
Bear with me guys I will keep asking lot of questions. Thanks in advance for your time and response. BK