aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes NX: UrlyBird Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "NX: UrlyBird "suncertify" package?" Watch "NX: UrlyBird "suncertify" package?" New topic
Author

NX: UrlyBird "suncertify" package?

Chee-Chan Keng
Greenhorn

Joined: Mar 01, 2004
Posts: 24
Hi,
I am a bit confused with the package structure for the interface file:
"...Your data access class must be called "Data.java", must be in a package called "suncertify.db", and must implement the follosing interface:
package suncertify.db;
public interface DB {...}"
".. The JAR file must have the following layout... A directory called code, containing all the source code..."
Assuming my JAR root is at c:\exam, does that mean my directory structure below is correct:
c:\exam\runme.jar
c:\exam\db-1x2.db (my data file)
c:\exam\code\suncertify\db\DB.java
c:\exam\code\suncertify\db\Data.java
c:\exam\code\Main.java (contains the main() method)
c:\exam\code\gui\... (GUI codes)
c:\exam\code\remote\... (RMI codes)
c:\exam\docs\
c:\exam\docs\javadoc
Then how do I access my data file from Main.java??? using "..\db-1x2.db"?

And where do I store the .class files? in the same directory as the .java files?

thanks!
George Marinkovich
Ranch Hand

Joined: Apr 15, 2003
Posts: 619
Hi Chee-Chan,
I think all your *.java files should be contained in a package of the form suncertify.xxx where xxx is db, remote, gui (whatever names you choose).
So your directory structure looks fine except for the line I've changed (in bold) below:
Assuming my JAR root is at c:\exam, does that mean my directory structure below is correct:
c:\exam\runme.jar
c:\exam\db-1x2.db (my data file)
c:\exam\code\suncertify\db\DB.java
c:\exam\code\suncertify\db\Data.java
c:\exam\code\suncertify\gui\Main.java (contains the main() method)
c:\exam\code\gui\... (GUI codes)
c:\exam\code\remote\... (RMI codes)
c:\exam\docs\
c:\exam\docs\javadoc
Then how do I access my data file from Main.java??? using "..\db-1x2.db"?

You're making the location of the database file configurable, aren't you? You could hard-code the database file location as "db-1x2.db", but give precedence to the database file location specified by the suncertify.properties file (if present) and allow the user to edit the suncertify.properties file from within your application.

And where do I store the .class files? in the same directory as the .java files?

All your class files are contained in your runme.jar, right? There's no need to include them anywhere else in your submission.



Regards, George
SCJP, SCJD, SCWCD, SCBCD
Chee-Chan Keng
Greenhorn

Joined: Mar 01, 2004
Posts: 24
George,
Did you forget to change the lines after Main.java, or u intend to leave them that way?
c:\exam\runme.jar
c:\exam\db-1x2.db (my data file)
c:\exam\code\suncertify\db\DB.java
c:\exam\code\suncertify\db\Data.java
c:\exam\code\suncertify\gui\Main.java (contains the main() method)
c:\exam\code\<b>gui\...</b> (GUI codes)
c:\exam\code\<b>remote\...</b> (RMI codes)
c:\exam\docs\
c:\exam\docs\javadoc
From my understanding with your post, the codes should all be under \code\suncertify, so there is really <b>no other file or folder</b> other than "suncertify" folder under \code?
I am confused with my import statement now, shouldn't they be "import code.suncertify.db" if we use the above directory structure?
I tried to follow the directory structure in Max's book, but the requirement sound different than his directory structure, which worried me :roll:
George Marinkovich
Ranch Hand

Joined: Apr 15, 2003
Posts: 619
Hi Chee_Chan,
Originally posted by Chee-Chan Keng:
Did you forget to change the lines after Main.java, or u intend to leave them that way?

No they're fine as they are.

From my understanding with your post, the codes should all be under \code\suncertify, so there is really <b>no other file or folder</b> other than "suncertify" folder under \code?

No all your code (in a package directory structure) is under c:\exam\code. All your code is in packages. Your package names are suncertify.db, suncertify.gui, etc.

I am confused with my import statement now, shouldn't they be "import code.suncertify.db" if we use the above directory structure?

No, for example, "import suncertify.db;" is consistent with the way your code is structured.

[ March 08, 2004: Message edited by: George Marinkovich ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NX: UrlyBird "suncertify" package?
 
Similar Threads
I am close to submit - Quetion a bout how to package
Thoughts wanted READMDE.txt
NX: Directory Structure
Question about package
URLyBird: runme.jar