M
Mkhululi.Tyukala
Hi All,
I am writing a swing application with the following functionality:
(1) There is a base class that supports things like changing the look
and feel – this is done via a JDialog that loads all the installed
lafs from which the user selects a choice.
(2) Enables the user to set/change the physical database properties –
location, password usernames and the like. -
The idea is that when the application starts up for the first time the
user will be asked to provide the database settings and then they will
be stored in a file and then every time the application starts the
settings will be loaded from this file. This works out fine!!!!!!!!!
Now here is the problem:
All the above is supported by an abstract class that extends JFrame
(I’ve put abstract after testing) - MySuperFrame. After testing, I
packaged this class together with other utility classes into a jar
file.
So my application which inherits from MySuperFrame fails on start-up
with an exception that the database settings file cannot be found –
And I know that it is in the jar file.
I think that my problem is the path and nothing but the path – or
relative path.+
This is the structure of my project:
There is the src and the bin directories and then there is an external
folder (not a package inside these two folders) called files (this is
where my database settings file is stored).
How do I solve this problem?
How do I make sure my application loads the settings file regardless
of where it is? I thought of passing the database settings file to a
constructor of a database settings dialog class. But I don’t know how
to sort out the path issue.
Please give me advice on how to implement that?
I am writing a swing application with the following functionality:
(1) There is a base class that supports things like changing the look
and feel – this is done via a JDialog that loads all the installed
lafs from which the user selects a choice.
(2) Enables the user to set/change the physical database properties –
location, password usernames and the like. -
The idea is that when the application starts up for the first time the
user will be asked to provide the database settings and then they will
be stored in a file and then every time the application starts the
settings will be loaded from this file. This works out fine!!!!!!!!!
Now here is the problem:
All the above is supported by an abstract class that extends JFrame
(I’ve put abstract after testing) - MySuperFrame. After testing, I
packaged this class together with other utility classes into a jar
file.
So my application which inherits from MySuperFrame fails on start-up
with an exception that the database settings file cannot be found –
And I know that it is in the jar file.
I think that my problem is the path and nothing but the path – or
relative path.+
This is the structure of my project:
There is the src and the bin directories and then there is an external
folder (not a package inside these two folders) called files (this is
where my database settings file is stored).
How do I solve this problem?
How do I make sure my application loads the settings file regardless
of where it is? I thought of passing the database settings file to a
constructor of a database settings dialog class. But I don’t know how
to sort out the path issue.
Please give me advice on how to implement that?