Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Application package directory problem



The problem seems to be that you want to configure where your derby db lives, not trying to change the dir shown by the save as dialog.

With derby, you can specify the full path to the database in the JDBC connection string, eg:

jdbc:derby:/path/to/derbydb

instead of:

jdbc:derby:derbydb

Another way is to set the derby home directory, and this will be used as a default location, eg:

java -Dderby.system.home=/path/to/where/i/want/derbydbs ...

All this and more is at http://db.apache.org

A quick google finds:

http://db.apache.org/derby/docs/dev/devguide/cdevdvlp34964.html
http://db.apache.org/derby/docs/dev/devguide/cdevdvlp13018.html




On 12 Oct 2007, at 21:04, David Leader wrote:

Please bear with me while I describe what is a slightly contorted problem. I'll try to be as brief as is consistent with clarity.

I have written a scientific java application that uses JDBC to connect to a database. Development was done with MySQL on localhost (also on unix server), but then we ported the database to Apache Derby (which is written in Java and allows embedding), in order to distribute both app and database together (for free). So far, so good. I can run the app as jar file - or as a Mac application package - with the db in a folder in the same directory. However, I would rather hide the database from  the user (especially as it is a folder/directory with zillions of files and subdirectories), within the app package. The way that the jdbc works (correct me if I'm wrong), I was unable to communicate with the db if I included it in the jar file containing the class files, but I could access it in the Resources directory in the .app if I set WorkingDirectory as $APP_PACKAGE/Contents/Resources/Java in the Java section of the Info.plist.

So far so good.

However I have an option in the application to save the graphics that the app displays in png format. When I invoke this from my application package the default location to save to is the WorkingDirectory specified above - ie within the app. Not a good default location for saving, to say the least! Half of my users will be sure to save files there. I suspect that I'm in a catch-22 situation, but surely I should be able to set the save dialogue so that it defaults somewhere outside the application package.

Other details. Most of the application GUI is written in Swing (java 1.4), but I use the AWT FileDialog,SAVE for saving the png, rather than whatever the Swing equivalent is, because I detest of Swing open and save dialogues as they are completely un-Mac-like. However I am aware of the limitations of the AWT, so if there were a way out here I might reconsider.

Any suggestions would be appreciated.

David
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden

References: 
 >Application package directory problem (From: David Leader <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.